Method addEagerConstraints does not exist

后端 未结 2 484
悲&欢浪女
悲&欢浪女 2021-01-12 18:06

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

2条回答
  •  清歌不尽
    2021-01-12 18:46

    where should come before with. This is what eloquent expects.

    It should be like this:

    $event = Event::with(['owner', 'participants'])->where('id', $id)->first();
    

提交回复
热议问题