Jak dodać regułę sprawdzania poprawności hasła w walidatorze? ZasadaReguła sprawdzania poprawności hasła Laravel
Walidacja:
hasło zawiera znaki z co najmniej trzech z pięciu następujących kategoriach:
- znaków English wielkimi (A - Z)
- angielskie małe litery (A - z)
- Podstawowa cyfra 10 cyfr (0 - 9)
- Niealfanumeryczna (na przykład:!, $, # lub%)
- znaków Unicode
Jak dodać powyższe reguły w regule walidatora?
Mój kod tutaj
// create the validation rules ------------------------
$rules = array(
'name' => 'required', // just a normal required validation
'email' => 'required|email|unique:ducks', // required and must be unique in the ducks table
'password' => 'required',
'password_confirm' => 'required|same:password' // required and has to match the password field
);
// do the validation ----------------------------------
// validate against the inputs from our form
$validator = Validator::make(Input::all(), $rules);
// check if the validator failed -----------------------
if ($validator->fails()) {
// get the error messages from the validator
$messages = $validator->messages();
// redirect our user back to the form with the errors from the validator
return Redirect::to('home')
->withErrors($validator);
}
Czy nie można przedstawić każdego znaku jako znaku * Unicode *? –