Skip to content

Commit 9c736d1

Browse files
committed
[bkintanar#17] Error in api/barangays
1 parent 9063dec commit 9c736d1

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

app/Http/Resources/BarangayResource.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function toArray($request)
6969
list($level1, $level1Resource, $level1Index) = $this->level1();
7070
list($level2, $level2Resource, $level2Index) = $this->level2($level1);
7171
list($level3, $level3Value, $level3Index) = $this->level3($level2);
72-
72+
7373
$region = isset($level3) ? $level3->region : (get_class($level2) != Region::class ? $level2->region : $level2);
7474

7575
return array_filter([
@@ -98,13 +98,10 @@ private function level2($level1)
9898
{
9999
switch (get_class($level1)) {
100100
case City::class:
101+
case Municipality::class:
101102
$level2Geographic = $this->level2Geographics[get_class($level1->geographic)];
102103
$level2 = $level1->geographic;
103104
break;
104-
case Municipality::class:
105-
$level2Geographic = $this->level2Geographics[get_class($level1->province)];
106-
$level2 = $level1->province;
107-
break;
108105
case SubMunicipality::class:
109106
$level2Geographic = $this->level2Geographics[get_class($level1->city)];
110107
$level2 = $level1->city;

0 commit comments

Comments
 (0)