If I dd($items);
in the controller, the result like this :
In the view blade laravel I check if collection empty like this :
@if($items)
...
@endif
But it does not work
How can I solve this problem?
If I dd($items);
in the controller, the result like this :
In the view blade laravel I check if collection empty like this :
@if($items)
...
@endif
But it does not work
How can I solve this problem?
You could use $items->isEmpty(); or $items->isNotEmpty();
Like so:
@if(!$items->isNotEmpty())
...
@endif
You can further read over here: https://laravel.com/docs/5.5/collections#method-isempty
i normally double check so that if i don't get the value the page keeps running :
@if(isset($items))
@if(!empty($items))
.....
@endif
@endif
hope it helps