. Advertisement .
..3..
. Advertisement .
..4..
I have the following programs code, but I do not know how to find the correct result. Why has this problem occurred, and how can it be solved? This is the code I am running:
protected function credentials(Request $request)
{
$admin=admin::where('email',$request->email)->first();
if(count($admin))
{
if($admin->status==0){
return ['email'=>'inactive','password'=>'You are not an active person, Please contact to admin'];
}
else{
return ['email'=>$request->email,'password'=>$request->password,'status'=>1];
}
}
return $request->only($this->username(), 'password');
}
This is the error text I receive:
"count(): Parameter must be an array or an object that implements Countable"
It is caused by PHP 7.2 NULL count() return Warning. You can change it.
To
Here’s a solution: