laravel - Eloquent filtering of nested -


I have such a DB format:

  user + id + email + password profile + ID + owner + ID (FK user.id) + Type_ID (FK type ID) + Address_ID (FK address.ID) + org_name + + + phone + email + url etc. posting + ID + profile_id (FK profile id) + title + Description Address + ID + Road + City + Province_ID (FK Provinces ID) + Country_ID (FK country.id) etc. Country ID + No Trying to use a well-known ORM to know a set of posting based on type_id, city, country_id and / or province_ad + m province + id + name + abbreviated country id  

I am here. These fields are subordinate objects on $ posting-> profiles-> addresses, etc.

Do I want to downgrade my debut - merge the address data into it to streamline the profile? Or, what is one way to do this without having to do all of my data without remodeling?

Assume that you have defined address for profile Regarding connection to ,

  $ posts = posting :: with (['profile' = & gt; function ($ query) usage ($ type_id) {$ query- & gt; UseTypeId ($ type_id)}, 'profile.address' = & gt; function ($ query) ($ country_id, $ province_id) {$ query- & gt; Where COUNTountId ($ country_id) - & gt; Where Travers ID $ Province_id);}]) - & gt; get ();  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

c# - Create dynamic LINQ query expression at runtime which translates into a parameterized SQL query for nullable types -

cmake - cpack generates RPMs with %files entries that conflict with the RPM spec. How to fix? -