get last id from collection in laravel code example
Example 1: Get last id in laravel
$last3 = DB::table('items')->latest('id')->first();
Example 2: laravel get last id
DB::table('myTable')->orderBy('id','desc')->first();
$last3 = DB::table('items')->latest('id')->first();
DB::table('myTable')->orderBy('id','desc')->first();