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