I'm experiencing some weird behaviour.
I'm selecting a single record from my database using:
Since I have to distinguish if I have a single record or multiple I need to count my records.
I'd like to use
Builder::count() for this. I call it inside my template as followed:
However, here's the part where I ... well ... get crazy.
If I use
Model::where(condition)->first()->count() I always end up getting 2 as result. On the other hand, if I use
count($model) or Model::where(condition)->get()->count() I end up getting the correct result (1), which is what I need.
I'm using Laravel 5.4 btw.
What am I missing? Any hint is appreciated!
Edit: changed Laravel 5.8 to Laravel 5.4.