I have two models, User and Event. I made a pivot table, invitations
between User and Event with a status
column. In my Event model definition, I w
When you're trying to do this:
->with('participants')
Laravel expects to get a relationship instance. In other words, you can't use this method as a relation.
where
should come before with
. This is what eloquent expects.
It should be like this:
$event = Event::with(['owner', 'participants'])->where('id', $id)->first();