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