Answers for "if null laravel 8"

PHP
3

laravel where is null

DB::table('users')	->whereNull('name')	->get();
Posted by: Guest on June-29-2020
0

check laravel first null

$user = User::where('mobile', Input::get('mobile'))->first(); // model or null
if (!$user) {
   // Do stuff if it doesn't exist.
}
Other techniques (not recommended, unnecessary overhead):

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

if (!$user->isEmpty()){
    $firstUser = $user->first()
}
Posted by: Guest on October-01-2021

Browse Popular Code Answers by Language