@foreach ($buildings as $building)
@php
$floors = $this->getFloors($building->id);
@endphp
{{ $building->name }}
@foreach ($floors as $floor)
@if ($floor == 0)
Floor
G
@else
Floor
{{ $floor }}
@endif
@php
$apartments = $this->getApartments($building->id, $floor);
@endphp
@foreach ($apartments as $apartment)
{{ $apartment->resident->first()->user->first_name . ' ' . $apartment->resident->first()->user->last_name }}
[Primary]
@endforeach
@endforeach
@endforeach