route('id'); // URL 파라미터에서 role ID 가져오기 $guardName = $this->input('guard_name', 'api'); return [ 'name' => [ 'required', 'string', 'max:100', Rule::unique('roles', 'name') ->where('tenant_id', $tenantId) ->where('guard_name', $guardName) ->ignore($roleId), ], 'guard_name' => 'required|in:api,web', 'description' => 'nullable|string|max:500', 'menu_permissions' => 'nullable|array', 'menu_permissions.*' => 'nullable|array', 'menu_permissions.*.*' => 'in:view,create,update,delete,approve,export,manage', ]; } /** * Get custom attributes for validator errors. */ public function attributes(): array { return [ 'name' => '역할 이름', 'guard_name' => 'Guard', 'description' => '설명', 'menu_permissions' => '메뉴 권한', ]; } /** * Get the error messages for the defined validation rules. */ public function messages(): array { return [ 'name.required' => '역할 이름은 필수입니다.', 'name.unique' => '이미 존재하는 역할 이름입니다.', 'name.max' => '역할 이름은 최대 100자까지 입력 가능합니다.', 'guard_name.required' => 'Guard는 필수입니다.', 'guard_name.in' => 'Guard는 api 또는 web만 선택 가능합니다.', 'description.max' => '설명은 최대 500자까지 입력 가능합니다.', ]; } }