bug fix
This commit is contained in:
@@ -47,13 +47,13 @@ class ScrapeMihaaruCommand 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" => $article["date"],
|
||||
"meta" => [
|
||||
"title" => $article["og_title"]
|
||||
|
@@ -25,11 +25,11 @@ class SourcesController extends Controller
|
||||
* @param mixed $source
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function show(Source $source) : JsonResponse
|
||||
public function show(Source $source)
|
||||
{
|
||||
return response()->json([
|
||||
'source' => new SourceResource($source),
|
||||
'articles' => ArticleResource::collection($source->articles()->paginate(8))
|
||||
'articles' => ArticleResource::collection($source->articles()->latest("published_date")->paginate(8))
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user