laravel insert data and return id code example
Example 1: Get last id in laravel
$last3 = DB::table('items')->latest('id')->first();
Example 2: Get last id in laravel
$last2 = DB::table('items')->orderBy('id', 'DESC')->first();
$last3 = DB::table('items')->latest('id')->first();
$last2 = DB::table('items')->orderBy('id', 'DESC')->first();