筆記中心

Laravel在Blade如何判斷 Eloquent Model有沒有資料?

Exists()  <----Collection沒有該方法

isEmpty() <----判斷collection是否有含資料

 

針對判斷單一個Row在database 取出來,存不存在的方法exists()exists有明顯的差異,覺得挺重要的先抄起來,參考下面連結

https://laracasts.com/discuss/channels/laravel/what-is-the-difference-between-exists-and-exists

文章標籤
全站熱搜
創作者介紹
創作者 蕭瑞文 的頭像
蕭瑞文

Neil的部落格

蕭瑞文 發表在 痞客邦 留言(0) 人氣(54)