get the last id in a collection laravel code example
Example 1: Get last id in laravel
$last3 = DB::table('items')->latest('id')->first();
Example 2: Get last id in laravel
$last = DB::table('items')->latest()->first();
$last3 = DB::table('items')->latest('id')->first();
$last = DB::table('items')->latest()->first();