Answers for "first or fail laravel"

PHP
3

laravel findorfail

$model = App\Flight::where('name', 'Mike')->firstOrFail();
Posted by: Guest on June-20-2020
1

eloquent first

$user = User::where('mobile', Input::get('mobile'))->get();

if (!$user->isEmpty()){
    $firstUser = $user->first()
}
Posted by: Guest on August-07-2020

Browse Popular Code Answers by Language