lundi 20 janvier 2020

Laravel: Get last items from relation grouped by

Season::with(['temps' => function($query) {
            $query->whereRAW('id in (select max(id) from temperatures where season_id=@row.id@ group by user_id desc)');
        }])->find(2);

Hi, i try to replace @row.id@ with current row id. I have many temps for each season, and i need to extract last temp sended by each user.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3auZ4No
via IFTTT

Aucun commentaire:

Enregistrer un commentaire