GigaC
2 years ago

Inception

Posted 2 years ago by GigaC

Hello Laracasters :)))),

I have an inception question about dream within a dream :D

I have these 4 tables:

TableA, TableB, TableC, TableD.

  • TableD is rellated with TableC with foreign key tableC_id <- tableD belongs to tableC
  • TableC is rellated with TableB with foreign key tableB_id <- tableC belongs to tableB
  • TableB is rellated with TableA with foreign key tableA_id <- tableB belongs to tableA

and the relations inside are hasMany, and belongsTo. This is simple and it is all working. So if I want to access all tableD items from tableC item, it is simple $tableC->tableD relation.

How can I access items from tableD via tableA.

So far I can get all tableD items from tableB with hasManyThrough, but I wasn't able to make it work from the first tableA.

Please sign in or create an account to participate in this conversation.