我通过执行Eloquent 的查询创建视图,然后将其传递给Blade.
@if($contacts != null)
//display contacts
@else
You dont have contacts
@endif
However it always assume that $contacts has something even if the query gives me nothing.
I did dd($contacts)
and get:
Collection {#247 ▼
#items: []
}
我怎么判断它是不是空的?