Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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()
}
 
PREVIOUS NEXT
Tagged: #check #laravel #null
ADD COMMENT
Topic
Name
5+7 =