I forgot to mention that I've tried with propertyStatus.status, property_status.status, but with no result...
In this case where you are just retriving one single property model with all one-one relations, why are you lazy-loading ?
I mean, lazy loading or not, the number of queries will be anyway 4 !
If not can you give a view of your schema.
It eager loading, by the definition from here: http://laravel.com/docs/eloquent#eager-loading
Besides, the result that I'm returning to the user in through API and is in JSON format and that's why I need to select only certain columns and not all of them.
I'll redefine my question, in case I was not clear. This example is from the Query Builder documentation:
DB::table('users')
->join('contacts', 'users.id', '=', 'contacts.user_id')
->join('orders', 'users.id', '=', 'orders.user_id')
->select('users.id', 'contacts.phone', 'orders.price')
->get();
Can I select specific columns like that using Eloquent?
$this->users->
with('contacts', 'orders')->
get(array('users.id', 'contacts.phone', 'orders.price')->toArray();
I saw that it can be done using closure, but it can get messy if we have more joins using with().
I need that function as well. Would it be difficult to implement?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community