I'm building application with Laravel, Inertiajs and Vue3. There are three key tables in application: Operators, Locations and Terminals. Terminals belongs to Locations and Locations belongs to Operators. There is no direct relations between Operators and Terminals. I would like to display list of Operators with counting locations and counting their terminals.
For example. Operator John Doe have 3 locations. Every his location have 3 terminals. Result should be:
John Doe | 3 | 9
something like this:
$operators = Operator::countWith('locations')->countWith('locations.terminals')->get()
Of course, this doesn't work, but is there some similar options to get this counts?