Answer the question
In order to leave comments, you need to log in
How to make deep HasManyThrough in laravel?
Good day!
I created a relation like this: Тип.Город.Улица.Дом.Квартира
In this respect, the apartment should depend on the House and on the Type at the same time - you need to get something like this request:
select * from `apartments` where `apartments`.`home_id` in ('1', '2', '3') and `type_id` = '777'
Answer the question
In order to leave comments, you need to log in
You have a strange request.
Select just a subquery with an indication of the type, if necessary.
Links go along the chain, they are not non-accumulative.
Only if the values of all tables are unique (there are created for each bundle), then at the end there would be an apartment that belongs to the original type.
And if it's just dictionaries, then of course it won't work that way.
With regular hasOne relationships, nesting is not limited in any way.
And you can do it like this:
client.address.city.regionsCity.region
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question