id petani

This commit is contained in:
2026-04-23 14:41:04 +07:00
parent 36f5a0d580
commit 42c4f687ea
@@ -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));
}