From 9df021db1ced3c9478c3f4350b9030d9875e2d0e Mon Sep 17 00:00:00 2001 From: "fauzgabriel@gmail.com" Date: Wed, 29 Apr 2026 15:36:20 +0700 Subject: [PATCH] request id when null Co-authored-by: Copilot --- app/Http/Controllers/Api/ProfileController.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Api/ProfileController.php b/app/Http/Controllers/Api/ProfileController.php index 696b1dd..a233412 100644 --- a/app/Http/Controllers/Api/ProfileController.php +++ b/app/Http/Controllers/Api/ProfileController.php @@ -29,10 +29,16 @@ class ProfileController extends Controller $user = Auth::user(); $profile = $user->profile; - $profileId = $user->role === 'petani' ? $profile->id : $request->id; + $requestID = null; + if($request->has('id')) { + $requestID = $request->id; + } + + $profileId = $user->role === 'petani' ? $profile->id : $$requestID; $desaKelurahanId = null; - if ($profile->role === 'fasilitator') { + if ($profile->role === 'fasilitator' || $profile->role === 'super_admin') { + $desaKelurahanId = $request->desa_kelurahan_id; $desaKelurahanId = $profile->desa_kelurahan_id; }