最佳答案
use App\Models\Post;
// 检索至少有一条评论的文章... $posts = Post::has ('comments')->get ();
// 没有评论的文章 $posts = Post::doesntHave ('comments')->get ();
讨论数量:
use App\Models\Post;
// 检索至少有一条评论的文章... $posts = Post::has ('comments')->get ();
// 没有评论的文章 $posts = Post::doesntHave ('comments')->get ();
推荐文章: