Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a9d24c4

Browse files
committed
switchersssssss
1 parent 79a9953 commit a9d24c4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

app/Http/Controllers/Api/V4/FacilityController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function index(): JsonResponse
3030
$query = Location::query()->orderBy( 'name' );
3131

3232
if ( $activeOnly ) {
33-
$query->whereHas( 'cabinets.switcher' );
33+
$query->whereHas( 'cabinets.switchers' );
3434
}
3535

3636
$facilities = $query->get()->map( fn( Location $l ) => $this->formatFacility( $l ) );
@@ -78,7 +78,7 @@ private function formatFacility( Location $l, bool $detailed = false ): array
7878
// Switches at this facility
7979
$switches = [];
8080
foreach ( $l->cabinets as $cab ) {
81-
foreach ( $cab->switcher ?? [] as $sw ) {
81+
foreach ( $cab->switchers as $sw ) {
8282
$switches[] = [
8383
'name' => $sw->name,
8484
'infrastructure' => $sw->infrastructureModel?->name,

0 commit comments

Comments
 (0)