Total Complexity | 5 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class Province extends State |
||
14 | { |
||
15 | /** |
||
16 | * @return HasMany |
||
17 | */ |
||
18 | public function cities(): HasMany |
||
19 | { |
||
20 | return $this->hasMany(City::class, 'state_id'); |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * @return HasManyThrough |
||
25 | */ |
||
26 | public function districts(): HasManyThrough |
||
27 | { |
||
28 | return $this->hasManyThrough(District::class, City::class); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * @return string |
||
33 | */ |
||
34 | public function getLogoPathAttribute() |
||
35 | { |
||
36 | $folder = 'indonesia-logo/'; |
||
37 | $id = $this->getAttributeValue('id'); |
||
38 | $arr_glob = glob(public_path().'/'.$folder.$id.'.*'); |
||
39 | if (count($arr_glob) == 1) { |
||
|
|||
40 | $logo_name = basename($arr_glob[0]); |
||
41 | $logo_path = url($folder.$logo_name); |
||
42 | |||
43 | return $logo_path; |
||
44 | } |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @return string |
||
49 | */ |
||
50 | public function getAddressAttribute(): string |
||
55 | ); |
||
56 | } |
||
57 | } |
||
58 |