Closed ghost closed 8 years ago
How translate this query to the ORM?
SELECT E.*, A.* FROM episodes as E INNER JOIN animes as A WHERE E.anime_id = A.id AND A.status = 'Ongoing' ORDER BY E.updated_at DESC LIMIT 15;
I've already tried:
$ongoing = Episode::orderBy('updated_at','desc')->including(['anime' => function($q) { $q->where('status', '=', 'Ongoing'); }])->limit(15)->all();
srry bad English.
Hi,
This should work:
Episode::join('animes', 'animes.id', '=', 'episodes.anime_id') ->where('anime.status', '=', 'Ongoing') ->descending('updated_at') ->limit(15) ->all();
thanks
How translate this query to the ORM?
I've already tried:
srry bad English.