Support the ongoing development of Laravel.io →
Laravel Database Blade
0

change your date column in migration file like this : $table->date('date');

drakentar, amirhossein256 liked this reply

2

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 ]);
    }
0

try this : ->latest('date')

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.