From 86fa7502174dbed4d2ed6bf595c3acb38c45455d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Tue, 3 Feb 2026 14:01:49 +0900 Subject: [PATCH] =?UTF-8?q?fix:=ED=94=84=EB=A1=9C=ED=95=84=20=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=20=EC=88=98=EC=A0=95=20=EA=B6=8C=ED=95=9C=EC=9D=84=20?= =?UTF-8?q?=EC=B5=9C=EA=B3=A0=EA=B4=80=EB=A6=AC=EC=9E=90=EB=A1=9C=20?= =?UTF-8?q?=EC=A0=9C=ED=95=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Requests/UpdateProfileRequest.php | 7 ++++++- app/Services/ProfileService.php | 7 ++++++- resources/views/profile/index.blade.php | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/Http/Requests/UpdateProfileRequest.php b/app/Http/Requests/UpdateProfileRequest.php index 87feec04..7895a229 100644 --- a/app/Http/Requests/UpdateProfileRequest.php +++ b/app/Http/Requests/UpdateProfileRequest.php @@ -21,8 +21,13 @@ public function authorize(): bool */ public function rules(): array { + // 최고관리자만 이름 수정 가능 + $nameRule = auth()->user()->isSuperAdmin() + ? 'required|string|max:100' + : 'nullable'; + return [ - 'name' => 'required|string|max:100', + 'name' => $nameRule, 'phone' => 'nullable|string|max:20', ]; } diff --git a/app/Services/ProfileService.php b/app/Services/ProfileService.php index 27b046dc..ade5056f 100644 --- a/app/Services/ProfileService.php +++ b/app/Services/ProfileService.php @@ -9,10 +9,15 @@ class ProfileService { /** * 프로필 정보 수정 (이름, 전화번호) + * 이름은 최고관리자만 수정 가능 */ public function updateProfile(User $user, array $data): bool { - $user->name = $data['name']; + // 최고관리자만 이름 수정 가능 + if ($user->isSuperAdmin() && isset($data['name'])) { + $user->name = $data['name']; + } + $user->phone = $data['phone'] ?? null; $user->updated_by = $user->id; diff --git a/resources/views/profile/index.blade.php b/resources/views/profile/index.blade.php index 2d92b4b0..3f37d084 100644 --- a/resources/views/profile/index.blade.php +++ b/resources/views/profile/index.blade.php @@ -60,11 +60,16 @@ class="w-full px-4 py-2 border border-gray-200 rounded-lg bg-gray-50 text-gray-5
+ @if(auth()->user()->isSuperAdmin()) + @else + + @endif