Laravel nested relationships

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

If you only want to select certain fields from the persons table, use this:

return Event::with(['city.companies.persons' => function ($query) {
    $query->select('id', '...');
}])->get();

Leave a Comment