Laravel Password & Password_Confirmation Validation

前端 未结 7 1532
甜味超标
甜味超标 2020-12-23 17:16

I\'ve been using this in order to edit the User Account Info:

$this->validate($request, [
    \'password\' => \'min:6\',
    \'password_confirmation\'          


        
7条回答
  •  囚心锁ツ
    2020-12-23 18:03

    Try doing it this way, it worked for me:

    $this->validate($request, [
    'name' => 'required|min:3|max:50',
    'email' => 'email',
    'vat_number' => 'max:13',
    'password' => 'min:6|required_with:password_confirmation|same:password_confirmation',
    'password_confirmation' => 'min:6'
    ]);`
    

    Seems like the rule always has the validation on the first input among the pair...

提交回复
热议问题