how to get last inserted id from a table laravel code example
Example 1: return last inserted id in laravel
$id = DB::table('users')->insertGetId([
'email' => '[email protected]',
'votes' => 0
]);
Example 2: return last inserted id in laravel
DB::getPdo()->lastInsertId();