route('id'); // URL 파라미터에서 role ID 가져오기 return [ 'name' => [ 'required', 'string', 'max:100', Rule::unique('roles', 'name') ->where('tenant_id', $tenantId) ->where('guard_name', 'web') ->ignore($roleId), ], 'description' => 'nullable|string|max:500', 'permissions' => 'nullable|array', 'permissions.*' => 'exists:permissions,id', ]; } /** * Get custom attributes for validator errors. */ public function attributes(): array { return [ 'name' => '역할 이름', 'description' => '설명', 'permissions' => '권한', ]; } /** * Get the error messages for the defined validation rules. */ public function messages(): array { return [ 'name.required' => '역할 이름은 필수입니다.', 'name.unique' => '이미 존재하는 역할 이름입니다.', 'name.max' => '역할 이름은 최대 100자까지 입력 가능합니다.', 'description.max' => '설명은 최대 500자까지 입력 가능합니다.', 'permissions.*.exists' => '유효하지 않은 권한이 포함되어 있습니다.', ]; } }