Constraining Eager Loads is what you want to read. You just pass a callback function as the 2nd parameter of with() and add your constraints for the child relationship(s): https://laravel.com/docs/5.8/eloquent-relationships#constraining-eager-loads
Mar 5, 2019
1
Level 1
Eloquent Query
i have two model one is user other one is userprofile with relationship
this query is work perfect User::with('profile')->find($id)->get();
but i know to get record to set condition on userprofile table how i can put condition on userprofile table and get record in this above case i can only put condition only in user table like find, where etc....
Please or to participate in this conversation.