eloquent first

Solutions on MaxInterview for eloquent first by the best coders in the world

showing results for - "eloquent first"
Mélissa
15 May 2020
1// return first row by id
2$user = App\User::where('id',$id)->first();
3// or return directly a field
4$userId = App\User::where(...)->pluck('id');
Thiago
06 May 2018
1$user = User::where('mobile', Input::get('mobile'))->get();
2
3if (!$user->isEmpty()){
4    $firstUser = $user->first()
5}