Relationship through multiple tables and join tables
I have an Organisation table which has many Users.
Those Users can have many Properties via a pivot table.
What I'd like to do is use Eloquent to select all the properties that 'belong' to an Organisation (i.e. properties created by an organisation's users).
Organisations
ID
Users
Organisation ID
Properties
ID
And the pivot table:
property_user
property_id
user_id
I realise I could do this with the query builder but currently I've managed to use only Eloquent relationships in models.
HasManyThrough might not work in this scenario, this is like a many-to-many relationship between Users and Properties. You can simply query relationship existence: