laravel belongsto nested 1

laravel belongsto nested

return Event::with('city.companies.persons')->get();

Here is what the above code is Doing:
1. We’re using the with() method to eager load the city relationship.
2. We’re using the with() method again to eager load the companies relationship.
3. We’re using the with() method again to eager load the persons relationship.

Similar Posts