diff --git a/app/Services/ConfigApiService.php b/app/Services/ConfigApiService.php index bd1291c12..6c21e796b 100644 --- a/app/Services/ConfigApiService.php +++ b/app/Services/ConfigApiService.php @@ -14,11 +14,11 @@ public function desa(array $filters = []) return Cache::remember($cacheKey, $this->cacheTtl, function () use ($filters) { $data = $this->apiRequest('/api/v1/config/desa', $filters); - if (! $data) { + if (!$data) { return collect([]); } - return collect($data)->map(fn ($item) => (object) $item['attributes']); + return collect($data)->map(fn($item) => (object) $item['attributes']); }); } @@ -26,7 +26,7 @@ public function desaConfig(array $filters = []) { // Panggil API dan ambil data $data = $this->apiRequest('/api/v1/config/desa', $filters); - if (! $data) { + if (!$data) { return collect([]); } @@ -44,25 +44,30 @@ public function kecamatan(array $filters = []) return Cache::remember($cacheKey, $this->cacheTtl, function () use ($filters) { $data = $this->apiRequest('/api/v1/config/kecamatan', $filters); - if (! $data) { + if (!$data) { return collect([]); } - return collect($data)->map(fn ($item) => (object) $item['attributes']); + return collect($data)->map(fn($item) => (object) $item['attributes']); }); } public function kabupaten(array $filters = []) { - $cacheKey = $this->buildCacheKey('config_kabupaten', $filters); + if (empty($filters)) { + $identitas = \App\Models\Identitas::first(); + $kode_kabupaten = str_replace('.', '', $identitas->kode_kabupaten); + $filters['filter[kode_kabupaten]'] = $kode_kabupaten; + } + $cacheKey = $this->buildCacheKey('config_kabupaten', $filters); return Cache::remember($cacheKey, $this->cacheTtl, function () use ($filters) { $data = $this->apiRequest('/api/v1/config/kabupaten', $filters); - if (! $data) { + if (!$data) { return collect([]); } - return collect($data)->map(fn ($item) => (object) $item['attributes']); + return collect($data)->map(fn($item) => (object) $item['attributes']); }); } diff --git a/catatan_rilis.md b/catatan_rilis.md index eed4733fd..e616efcee 100644 --- a/catatan_rilis.md +++ b/catatan_rilis.md @@ -15,6 +15,7 @@ Di rilis ini, versi 2604.0.0 berisi penambahan dan perbaikan yang diminta penggu 1. [#954](https://github.com/OpenSID/OpenKab/issues/954) Perbaikan list menu tidak tampil. 2. [#369](https://github.com/OpenSID/API-Database-Gabungan/issues/369) Perbaikan cache artikel tidak dihapus setelah operasi hapus. +3. [#1015](https://github.com/OpenSID/OpenKab/issues/1015) Batasi opsi kabupaten berdasarkan pengaturan yang ada di API satu data. #### Perubahan Teknis diff --git a/resources/views/components/wilayah_filter_js.blade.php b/resources/views/components/wilayah_filter_js.blade.php index e3df56035..8316c297d 100644 --- a/resources/views/components/wilayah_filter_js.blade.php +++ b/resources/views/components/wilayah_filter_js.blade.php @@ -1,8 +1,16 @@ @push('js')