id petani
This commit is contained in:
@@ -135,11 +135,10 @@ class ProfileController extends Controller
|
|||||||
|
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$profile = $user->profile;
|
$profile = $user->profile;
|
||||||
$profileId = $user->role === 'petani' ? $profile->id : $id;
|
$profileId = ($user->role === 'petani') ? $profile->id : $id;
|
||||||
|
|
||||||
$profile = Profile::with('desaKelurahan')
|
$profile = Profile::with('desaKelurahan')
|
||||||
->when($profileId, fn($q,$v) => $q->where('id',$v))->first();
|
->where('id', $profileId)->firstOrFail();
|
||||||
// ->where('user_id', Auth::id())->first();
|
|
||||||
return response()->json(new ProfileResource($profile));
|
return response()->json(new ProfileResource($profile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user