get last inserted id laravel eloquent code example
Example 1: laravel get last id
DB::table('myTable')->orderBy('id','desc')->first();
Example 2: laravel get ID from insert
$data = User::create(['name'=>'first']);
dd($data->id);
Example 3: laravel model save get id
$data->save();
$data->id;