karakteristik petani

This commit is contained in:
2026-10-06 17:52:34 +07:00
parent 7fdf9b400d
commit 393cf0d0d1
9 changed files with 5489 additions and 2979 deletions
@@ -103,9 +103,21 @@ class IndeksPetaniController extends Controller
abort(403);
}
return redirect()->route('dashboard.profil-pertanian', array_merge($request->query(), [
'tab' => 'indeks-petani',
]));
}
public function contentData(Request $request): array
{
$filters = $this->filters($request);
$title = 'Dashboard Profil Petani';
$segments = $this->segments();
$colors = collect($segments)
->pluck('color')
->map(fn($c) => "var(--bs-{$c})")
->values();
$komoditas = Komoditas::where('is_utama', true)->get();
$petaniQuery = $this->petaniQuery($filters);
@@ -125,6 +137,11 @@ class IndeksPetaniController extends Controller
->distinct()
->get();
$provinsi = $desaKelurahan
->unique('provinsi_id')
->sortBy('provinsi')
->values();
$wilayah = $desaKelurahan
->groupBy('provinsi_id')
->map(function ($provinsi) {
@@ -157,12 +174,15 @@ class IndeksPetaniController extends Controller
];
})->values();
return view('dashboard.indeks-petani', array_merge($filters,
return array_merge($filters,
compact(
'komoditas',
'desaKelurahan',
'provinsi',
'wilayah',
)));
'segments',
'colors',
));
}
public function summary(Request $request): JsonResponse
@@ -655,4 +675,4 @@ class IndeksPetaniController extends Controller
return response()->json($data);
}
}
}