laravel retrieve inserted record id code example Example: laravel get last id DB::table('myTable')->orderBy('id','desc')->first();