laravel lastid after insert code example
Example 1: laravel query builder get last insert id
$id = DB::table('users')->insertGetId(
['email' => '[email protected]', 'votes' => 0]
);
Example 2: laravel db insert get last id
$id = DB::table('users')
->insertGetId(
['name' => 'Akash Savani', 'email'=>'[email protected]']
);