SmokeTM
265
6
Laravel

I wanna get all articles with votes

Posted 8 months ago by SmokeTM

I try to get all articles with a certain amount of votes. In this case 5. Someone knows how to do that?

  $articles = Article::with('user', 'categorie', 'comments', 'votes')
            ->withCount('votes', 'cryptoVotes')
            ->where('created_at', '<=', Carbon::now()->subHour(1))
            ->where('sum(crypto_votes_count)', '>', 5)
            ->paginate(20);

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.