Answer the question
In order to leave comments, you need to log in
How to display companies by the number of comments?
$top_companies =Company::query()
->where(...) // где коментариев больше както так
->paginate(8);
Answer the question
In order to leave comments, you need to log in
->where('Comments', '>', 8)
My answer is given exactly as the question is asked. However, in reality the comments and their number will not be stored in the same table. Most likely, there is some kind of table with a foreign key to the companies table, you need to JOIN this table and in the condition rely on the number of records in it, and not in the main table.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question