标签: php laravel
我知道标题似乎有点复杂,但我想要的是简单的
users
comments
hasMany
答案 0 :(得分:0)
使用has():
has()
$users = User::has('comments')->get();
或者急切加载user的评论模型:
user
$users = User::has('comments')->with('comments')->get();
来源: http://laravel.com/docs/eloquent#querying-relations