last inserted id in laravel 8 code example
Example 1: laravel get ID from insert
$data = User::create(['name'=>'first']);
dd($data->id);
Example 2: laravel model save get id
$data->save();
$data->id;
$data = User::create(['name'=>'first']);
dd($data->id);
$data->save();
$data->id;