1
在Laravel 5我能找到有使用has
方法至少一個註釋的所有帖子:Laravel 5 - ORM具有()的關係(反 - notHas)
// Retrieve all posts that have at least one comment...
$posts = App\Post::has('comments')->get();
正如世界上沒有其他方法一樣notHas
,如何我可以找到所有沒有評論的帖子嗎? (記住,這是一個hasMany
關係)
參考:
查詢關係存在
http://laravel.com/docs/5.1/eloquent-relationships#querying-relations