|string> */ public function rules(): array { return [ 'name' => 'max:100', 'email'=> 'email|unique:users', 'username'=>'max:30|unique:users', 'password' => 'min:6|regex:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{6,}$/', // 至少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', 'gender'=>'in:1,0', 'address'=>'max:255', 'company_id'=>'exists:company,id', 'department_id'=>'exists:department,id', 'role_id'=>'exists:roles,id', ]; } }