DEV Community

Cover image for Laravel error count(): Parameter must an array or an object that implements Countable (Solution)
Osman Forhad
Osman Forhad

Posted on

Laravel error count(): Parameter must an array or an object that implements Countable (Solution)

So, in that case i am searching solution for this once finally I got the solution. Then I think it’s a php version related error.
So, I decide to place the block of code in the top of the controller file (which controller file the error is generate). the code I got place is like below:
Alt Text
Now I am ready to reload the tab and I see the error is solved.
The block of code I can also place in the top of routes.php file. And this is another method.
So, for solve count(): Parameter must an array error in Laravel. We can put version_compare condition in routes file or controller where we want. And it will solve easily.

thats it.
.
Happy Coding.
osman forhad
Mobile & Web Application Developer💻

Top comments (0)

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay