I have three classes:
Block (has no relationships columns)
Element (has block_id)
Atom (has element_id)
As I see I can get Block's Atmos by making this relationship:
return $this->hasManyThrough(Atom::class, Element::class, 'block_id', 'element_id');
But what I need to do it so make query with getting all the blocks which has at least one atom insite any of their elements.
And after that I want to order Blocks by created_at Atom column with this Atom parameters.
It should be like that:
- Block #1028
- Atom - created_at 14/05/2023 ...other columns
- Block #531
- Atom - created_at 16/05/2023 ...other columns