Laravel / Eloquent : hasManyThrough WHERE

后端 未结 3 2150
执念已碎
执念已碎 2021-01-05 18:42

In the documentation of Eloquent it is said that I can pass the keys of a desired relationship to hasManyThrough.

Lets say I have Models named Count

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-05 19:13

    $user_id = 3;
    
    $country = Country::find($country_id);
    
    $country->posts()->where('users.id', '=', $user_id)->get();
    

提交回复
热议问题