Running the todays pick on a transformer

This commit is contained in:
2020-08-20 04:16:41 +05:00
parent bcd55d7349
commit 4e671f7ca0

View File

@@ -24,6 +24,20 @@ class TodaysPick extends Controller
->inRandomOrder() ->inRandomOrder()
->take(8) ->take(8)
->get() ->get()
->unique('source.name')->values()->toArray(); ->transform(function ($article) {
return [
"id" => $article->id,
"title" => $article->title,
"url" => $article->url,
"author" => $article->author,
"featured_image" => $article->featured_image,
"published_date" => $article->published_date,
"meta" => $article->meta,
"source" => $article->source
];
})
->unique('source.name')
->values()
->toArray();
} }
} }