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();