Bug fix
This commit is contained in:
@@ -48,19 +48,21 @@ class ScrapeSunCommand extends Command
|
||||
foreach ($articles as $article) {
|
||||
|
||||
// Attach the relationship between source and article and return the curren article instance
|
||||
$articleModel = $source->articles()->firstOrCreate([
|
||||
$articleModel = $source->articles()->firstOrCreate(
|
||||
["guid" => $article["guid"]],
|
||||
[
|
||||
"title" => $article["title"],
|
||||
"url" => $article["url"],
|
||||
"author" => $article["author"],
|
||||
"featured_image" => $article["image"],
|
||||
"body" => $article["content"],
|
||||
"guid" => $article["guid"],
|
||||
"published_date" => Carbon::parse($article["date"])->format("Y-m-d H:i:s"),
|
||||
"meta" => [
|
||||
"title" => $article["og_title"]
|
||||
]
|
||||
|
||||
]);
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +72,6 @@ class ScrapeSunCommand extends Command
|
||||
|
||||
$topicModel->articles()->syncWithoutDetaching($articleModel);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -48,19 +48,21 @@ class ScrapeThiladhunCommand extends Command
|
||||
foreach ($articles as $article) {
|
||||
|
||||
// Attach the relationship between source and article and return the curren article instance
|
||||
$articleModel = $source->articles()->firstOrCreate([
|
||||
$articleModel = $source->articles()->firstOrCreate(
|
||||
["guid" => $article["guid"]],
|
||||
[
|
||||
"title" => $article["title"],
|
||||
"url" => $article["url"],
|
||||
"author" => $article["author"],
|
||||
"featured_image" => $article["image"],
|
||||
"body" => $article["content"],
|
||||
"guid" => $article["guid"],
|
||||
"published_date" => Carbon::parse($article["date"])->format("Y-m-d H:i:s"),
|
||||
"meta" => [
|
||||
"title" => $article["og_title"]
|
||||
]
|
||||
|
||||
]);
|
||||
]
|
||||
);
|
||||
|
||||
collect($article["topics"])->each(function ($topic) use ($articleModel) {
|
||||
$topicModel = Topic::firstOrCreate(["slug" => $topic["slug"]], ["name" => $topic["name"]]);
|
||||
|
Reference in New Issue
Block a user