Support the ongoing development of Laravel.io →
Database Eloquent Architecture
Last updated 2 years ago.
0

First off, I don't think you need all the joins. Laravel has a really neat relationship helper. If I've got the mist of your query right, you would set up the relationships on the model. Then you could run a query as such:

$property = Property::find(1)->with('cities', 'brokers', 'etc etc');
// this will then get the property with the ID of 1 and the related colums from other tables.

So depending on the relationship type for each table, you define that relationship on the model with a custom name and you can then query it like this...

$property_cities = $property->cities // where the relationship is defined as 'cities' on the property model

I hope that's answered your question. I'm not CI familiar, but in general, Laravel should offer a simple solution for these things.

Scope methods on the model cane be used for regular queries.

More on relationships here: http://laravel.com/docs/4.2/eloquent#relationships

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

andyc andyc Joined 30 Nov 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.