laravel get id with first code example
Example 1: laravel get ID from insert
$data = User::create(['name'=>'first']);
dd($data->id);
Example 2: laravel create get id
$id = $this->create($data)->id;
$data = User::create(['name'=>'first']);
dd($data->id);
$id = $this->create($data)->id;