Answers for "if exists laravel"

PHP
2

check if file exists laravel

$file = public_path('storage/images/' . $value)

if(! file_exists($file)){
  return asset('storage/images/default.png');
}
Posted by: Guest on January-03-2021
1

laravel exist

if (User::where('email', $request->email)->exists()) {
   //email exists in user table
}
Posted by: Guest on July-31-2021
1

laravel exists validation

'state_id' => 'exists:states,id'
Posted by: Guest on January-18-2021
5

laravel check record exists

$user = User::where('email', '=', Input::get('email'))->first();
if ($user === null) {
   // user doesn't exist
}
Posted by: Guest on April-08-2020
1

if notexists in laravel query

if (User::where('email', '=', Input::get('email'))->exists()) {
   // user found
}
Posted by: Guest on July-23-2020
1

laravel exist

if($user->isEmpty()){
    // has no records
}
Posted by: Guest on July-31-2021

Browse Popular Code Answers by Language