change your date column in migration file like this : $table->date('date');
drakentar, amirhossein256 liked this reply
The SQL sentence is this :
select * from backup_models where date IN (SELECT MAX(date) FROM backup_models GROUP BY name);
and the solution was this:
public function index()
{
$object = DB::table('backup_models')
->whereIn('date', function($query) {
$query->select(DB::raw('MAX(date)'))
->from('backup_models')
->groupBy('name');
})
->get();
return view('backup.index',[ 'object' => $object ]);
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community