#How to do query on a eloquent relationship
4 messages · Page 1 of 1 (latest)
I think you can use a whereHas here https://laravel.com/docs/9.x/eloquent-relationships#querying-relationship-existence
You could also do it with a join
i wanted to order by it and the problem is deppend on the when condition