I have 2 models: Video
, Country
and want to retrieve the top 5 videos for each country ordered by number of views, and want to do that using the video model not the country model so i shall start with
$videos = Video::with('user')->orderBy('views', 'desc')->get();
So the code shall return videos from the top 5 for reach country
and will be appreciate if the solution that starts with County::with('videos')
is given
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire