|string> */ public function rules(): array { return [ 'name' => 'required|max:100', 'email' => 'required|email',//为了编辑时没改邮箱的情况不用required|email|unique:users 'password' =>'nullable|min:6|regex:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{6,}$/', // 编辑时可为空,包含大小写字母和数字,At least 6 digits, including upper and lower case letters and numbers 'auth_password' => [ 'required', function ($attribute, $value, $fail) { if (!Hash::check($value, Auth::user()->password)) { $fail("Wrong security authentication password!"); } } ], 'phone'=>'nullable|regex:/^\d{8,11}$/', 'gender'=>'nullable|in:1,0', 'address'=>'nullable|max:255', 'company_id'=>'exists:company,id', 'department_id'=>'nullable|exists:department,id', 'role_id'=>'required|exists:roles,id', ]; } }