get id value before put it in table laravel 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;