SHARE
TWEET

Untitled

a guest Jun 16th, 2019 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $casoValidator =  Validator::attribute('nombre',Validator::allOf(Validator::stringType(),Validator::notOptional(),
  2.      Validator::stringType()->length(3,100))) //nombre, validamos que sea cadena, que es obligatorio y que tiene de 3 a 100 caracteres
  3.     ->attribute('idUsuario',Validator::allOf(Validator::intType()))
  4.     ->attribute('numeroSertel',Validator::allOf(Validator::stringType(), Validator::stringType()->length(1,100)))
  5.     ->attribute('dni',Validator::allOf(Validator::stringType(), Validator::stringType()->length(8,20)));                                                                  //la capturaremos al hacer insert si hay problemas con las FK
  6.  
  7.  
  8.         try {
  9.             $asuntoValidator->assert($asunto);
  10.  
  11.         } catch(NestedValidationException $exception) {
  12.             $errors = $exception->findMessages([
  13.                 'length' => '{{name}} no puede tener mas de 100 caracteres ni menos de uno',
  14.                 'notOptional' => '{{name}} no es opcional',
  15.       ....
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top