route('id'); $rules = [ 'fullname' => 'required|string|max:255', 'username' => ['required', 'string', 'max:255', Rule::unique('user', 'username')->ignore($employeeId)], 'email' => ['required', 'email', 'max:255', Rule::unique('user', 'email')->ignore($employeeId)], 'role' => ['required', Rule::in(['Administrator', 'Sale', 'IT', 'Customer Service', 'Marketing'])], 'phone' => 'nullable|string|max:20', 'birthday' => 'nullable|date', 'address' => 'nullable|string|max:500', ]; if ($this->isMethod('POST')) { $rules['password'] = 'required|string|min:8|confirmed'; } else { $rules['password'] = 'nullable|string|min:8|confirmed'; } return $rules; } }