Topic Fix in commands

This commit is contained in:
2020-08-11 04:48:09 +05:00
parent 0687aa1687
commit 8c12b94777
3 changed files with 78 additions and 8 deletions

View File

@@ -63,10 +63,7 @@ class ScrapeThiladhunCommand extends Command
]);
collect($article["topics"])->each(function ($topic) use ($articleModel) {
$topicModel = Topic::firstOrCreate([
"name" => $topic["name"],
"slug" => $topic["slug"],
]);
$topicModel = Topic::firstOrCreate(["slug" => $topic["slug"]],["name" => $topic["name"]]);
$topicModel->articles()->syncWithoutDetaching($articleModel);
});