get latest data laravel code example
Example 1: how get the latest data in database in laravel
$last = DB::table('items')->latest()->first();
$last2 = DB::table('items')->orderBy('id', 'DESC')->first();
Example 2: get the last saved row in a table laravel
$last = DB::table('items;)->latest()->first();
Example 3: laravel get last record
return DB::table('files')->order_by('upload_time', 'desc')->first();