Answer the question
In order to leave comments, you need to log in
What is the correct way to use distinct in such a query?
Laravel version: 5.5.*
I use this method to get 50 rows from the database.
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$prices = Prices::where('name',$id)->take(50)->get();
return GraphResource::collection($prices);
}
$prices = Prices::where('name',$id)->take(50)->distinct('last_updated')->get();
Answer the question
In order to leave comments, you need to log in
id: 1, last_updated: 1524855575, price: 5000
id: 2, last_updated: 1524855575, price:5000.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question