Running the todays pick on a transformer
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user