count parameter must be an array or an object that implements countable in laravel

0 votes


Have shared my code below:

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'); 
}

When i run the code this error is displayed as:

"count(): Parameter must be an array or an object that implements Countable"

Feb 10 in Others by Soham
• 8,730 points
130 views

1 answer to this question.

0 votes

You will have to make one change to the lines of code which has been my solution and has worked for me. Please refer to the line mentioned below:-

count(array($variable));

answered Feb 10 by Rahul
• 8,980 points

Related Questions In Others

0 votes
1 answer

Reducing sequences in an array of strings

I've written a C# app to solves ...READ MORE

answered Nov 2, 2018 in Others by DataKing99
• 8,240 points
236 views
0 votes
1 answer

How can you create an object in JavaScript?

JavaScript supports Object concept very well. You can create ...READ MORE

answered Mar 7, 2019 in Others by Frankie
• 9,830 points
170 views
0 votes
1 answer

How can you create an Array in JavaScript?

You can define arrays using the array literal as ...READ MORE

answered Mar 7, 2019 in Others by Frankie
• 9,830 points
220 views
0 votes
1 answer

How to exclude specific folders every time I run 'eb deploy' using AWS EB CLI

If there is not .ebignore file it ...READ MORE

answered Oct 24, 2018 in AWS by Priyaj
• 58,060 points
1,290 views
0 votes
0 answers

Self Created Laravel Link Not Working

I installed laravel 6.0 through composer and ...READ MORE

Dec 3, 2019 in Others by anonymous
• 120 points
203 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,680 points
13,204 views
0 votes
1 answer

ng is not recognized as an internal or external command

I solved this problem in accordance with ...READ MORE

answered Feb 11 in Others by Rahul
• 8,980 points
1,184 views
0 votes
1 answer

ERROR:'keytool' is not recognized as an internal or external command, operable program or batch file

Check if the directory and the keytool ...READ MORE

answered Feb 18 in Others by Rahul
• 8,980 points
942 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP