profile with request id

This commit is contained in:
2026-04-22 13:49:56 +07:00
parent ded9b875fb
commit e0b8910e8d
@@ -27,6 +27,7 @@ class ProfileController extends Controller
$user = Auth::user();
$profile = $user->profile;
$profileId = $user->role === 'petani' ? $profile->id : $request->id;
$desaKelurahanId = null;
if ($profile->role === 'fasilitator') {
@@ -39,6 +40,7 @@ class ProfileController extends Controller
$search = strtolower($search);
$q->whereRaw('lower(nama) like ?', ["%{$search}%"]);
})
->when($profileId, fn($q,$v) => $q->where('id',$v))
->when($desaKelurahanId ?? $request->desa_kelurahan_id, fn($q,$v) => $q->where('desa_kelurahan_id',$v))
->when($request->kecamatan_id, fn ($q, $v) =>
$q->whereHas('desaKelurahan', fn ($k) =>