HOW TO VALIDATE STRONG PASSWORD VALIDATION IN LARAVEL ?

Solution :

$messages = [‘password.regex’ => “Your password must contain 1 lower case character 1 upper case character one number”];
$validator = Validator::make($request->all(), [
’email’ => ‘required|email’,
‘password’ => ‘min:6||regex:/^(?=\S[a-z])(?=\S[A-Z])(?=\S[\d])\S$/’,
], $messages);

 if ($validator->fails()) {
        $error_msg  =   $validator->messages()->all(); 
  }

render $error_msg to your view and write following code on view.
@if($error_msg)

    @foreach ( $error_msg as $key => $value)

  • {{ $value }}
  • @endforeach

@endif
Thanks 🙂

6 comments
  1. Nice post i like it 100 %. I learn something new and challenging on sites I stumbleupon on a daily basis. Its always helpful to read through articles from other writers and use something from their web sites.

Add Comment

Required fields are marked *. Your email address will not be published.