lundi 22 avril 2019

Occurences of user in events by date through pivot table

I have an Event model, that belongsToMany App\User through a pivot table event_user.

When I select a range of Event::sortable()->someScopes()->paginate() by date and some other filters I want a list of all users (every user occuring once) who have been on those events and the count of how many different events has everyone been to.

Can this be done this way or should I select Users and go down events, because I really need to avoid that.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire