where Id laravel code example
Example 1: DB::table('users')->get(); id 1
$users = DB::table('users')where('id','=', $userid)->get();
Example 2: laravel get ID from insert
$data = User::create(['name'=>'first']);
dd($data->id);
Example 3: laravel create get id
$user = User::create([
'username' => $data['username'] . ' ' . $data['username2'],
'mail' => $data['mail'],
'password' => bcrypt($data['password']),
]);
$userInfo = UserInformation::create([
'user_id' => $user->id,
'current_food' => $food,
'current_level' => $level,
]);
Example 4: laravel find query
$model = App\Models\Flight::where('legs', '>', 100)
->firstOr(['id', 'legs'], function () {
});