This commit is contained in:
2026-09-16 11:09:08 +07:00
parent a76b014056
commit 539239b507
10 changed files with 1049 additions and 23 deletions
@@ -51,9 +51,13 @@ class DesaKelurahanController extends Controller
return response()->json($desa);
}
public function getByKecamatan($kecamatan_id)
public function getByKecamatan(Request $request, $kecamatan_id)
{
$desa = DesaKelurahan::where('kecamatan_id', $kecamatan_id)
$query = $request->boolean('all_wilayah')
? DesaKelurahan::withoutGlobalScope('program')
: DesaKelurahan::query();
$desa = $query->where('kecamatan_id', $kecamatan_id)
->orderBy('nama', 'asc')
->get();
@@ -51,9 +51,13 @@ class KabupatenKotaController extends Controller
return response()->json($kabupaten);
}
public function getByProvinsi($provinsi_id)
public function getByProvinsi(Request $request, $provinsi_id)
{
$kabupaten = KabupatenKota::where('provinsi_id', $provinsi_id)
$query = $request->boolean('all_wilayah')
? KabupatenKota::withoutGlobalScope('program')
: KabupatenKota::query();
$kabupaten = $query->where('provinsi_id', $provinsi_id)
->orderBy('nama', 'asc')
->get();
@@ -51,9 +51,13 @@ class KecamatanController extends Controller
return response()->json($kecamatan);
}
public function getByKabupaten($kabupaten_id)
public function getByKabupaten(Request $request, $kabupaten_id)
{
$kecamatan = Kecamatan::where('kabupaten_kota_id', $kabupaten_id)
$query = $request->boolean('all_wilayah')
? Kecamatan::withoutGlobalScope('program')
: Kecamatan::query();
$kecamatan = $query->where('kabupaten_kota_id', $kabupaten_id)
->orderBy('nama', 'asc')
->get();