我看不到我的代码是否正常工作,因为尝试邮递员时验证失败。我对邮递员的处理如下。
我对邮递员所做的
unchecked header.
in the body, form-data
key: profile_photo
type:file
value: test.png (which is in the public folder of laravel)
规则
protected $create_rules = [
'username' => 'required|max:20|unique:users,username',
'email' => 'required|string|email|max:255|unique:users,email',
'password' => 'required',
// **in Production **
// 'password' => [
// 'required',
// 'min:6',
// 'regex:/^.*(?=.{3,})(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[\d\X])(?=.*[!$#%]).*$/',
// 'confirmed'
// ],
/**
* Three of the five rules.
* English uppercase characters (A – Z)
* English lowercase characters (a – z)
* Base 10 digits (0 – 9)
* Non-alphanumeric (For example: !, $, #, or %)
* Unicode characters
*/
'first_name' => 'required|string|max:255',
'last_name' => 'required|string|max:255',
'phone' => 'required|regex:/^([0-9\s\-\+\(\)]*)$/|min:5',
'role' => 'required',
'profile_photo.*' => 'image|mimes:jpeg,png,jpg'
];