Level 75
What is your goal?
Result for single model of this count(array($modelObj)) is everytime just 1.
With this you get a count of properties in your model.
count($modelObj->toArray());
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Is it better to implement countable interface on model class for using count() on that models? or should i use count(array($modelObj))
I am just updgrading my laravel version, so i encountered the warning count(): Parameter must be an array or an object that implements Countable
Please or to participate in this conversation.