Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
atmonshi committed Jul 29, 2023
1 parent 24a42f2 commit b4205c5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Filament/Pages/Importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
use LaraZeus\Rhea\RheaPlugin;
use LaraZeus\Sky\SkyPlugin;

class Importer extends Page
{
Expand Down Expand Up @@ -40,13 +41,13 @@ public function submit()
}

if ($this->truncate) {
$posts = config('zeus-sky.models.post')::get();
$posts = SkyPlugin::get()->getPostModel()::get();
$posts->each(function ($item, $key) {
$item->tags()->detach();
$item->delete();
});
Schema::disableForeignKeyConstraints();
config('zeus-sky.models.tag')::truncate();
SkyPlugin::get()->getTagModel()::truncate();
Schema::enableForeignKeyConstraints();

Notification::make()
Expand All @@ -55,8 +56,6 @@ public function submit()
->send();
}

// get by status todo
// get by post type todo
$posts = Post::where('post_status', '!=', 'auto-draft')->get();

foreach ($posts as $post) {
Expand All @@ -78,7 +77,7 @@ public function submit()

public function savePost($post)
{
$zeusPost = config('zeus-sky.models.post')::findOrNew($post->ID);
$zeusPost = SkyPlugin::get()->getPostModel()::findOrNew($post->ID);
if (! $zeusPost->exists || $this->overwrite) {
$zeusPost->id = $post->ID;
$zeusPost->title = $post->post_title;
Expand Down

0 comments on commit b4205c5

Please sign in to comment.