profile with request id
This commit is contained in:
@@ -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) =>
|
||||
|
||||
Reference in New Issue
Block a user