From 42c4f687eac1ab1c6062e8ba5f6974908018d207 Mon Sep 17 00:00:00 2001 From: "fauzgabriel@gmail.com" Date: Thu, 23 Apr 2026 14:41:04 +0700 Subject: [PATCH] id petani --- app/Http/Controllers/Api/ProfileController.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Api/ProfileController.php b/app/Http/Controllers/Api/ProfileController.php index cf98450..e161dcc 100644 --- a/app/Http/Controllers/Api/ProfileController.php +++ b/app/Http/Controllers/Api/ProfileController.php @@ -135,11 +135,10 @@ class ProfileController extends Controller $user = Auth::user(); $profile = $user->profile; - $profileId = $user->role === 'petani' ? $profile->id : $id; + $profileId = ($user->role === 'petani') ? $profile->id : $id; $profile = Profile::with('desaKelurahan') - ->when($profileId, fn($q,$v) => $q->where('id',$v))->first(); - // ->where('user_id', Auth::id())->first(); + ->where('id', $profileId)->firstOrFail(); return response()->json(new ProfileResource($profile)); }