get last id in laravel

37

$last3 = DB::table('items')->latest('id')->first();
$last = DB::table('items')->latest()->first();
DB::getPdo()->lastInsertId();
$id = DB::table('users')->insertGetId([
    'email' => '[email protected]',
    'votes' => 0
]);
$last2 = DB::table('items')->orderBy('id', 'DESC')->first();

Comments

Submit
0 Comments