I\'m trying to get the most popular hackathons which requires ordering by the respective hackathon\'s partipants->count(). Sorry if that\'s a little difficul
partipants->count()
Another approach can be by using withCount() method.
withCount()
Hackathon::withCount('participants') ->orderBy('participants_count', 'desc') ->paginate(50);
Ref: https://laravel.com/docs/5.5/eloquent-relationships#querying-relations