Created
November 8, 2016 19:44
-
-
Save raank/9f1446f20ef6f30be3a585f50f5dbc8f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace SyncMedic\Validators; | |
use \Prettus\Validator\Contracts\ValidatorInterface; | |
use \Prettus\Validator\LaravelValidator; | |
class LoginValidator extends LaravelValidator | |
{ | |
//RULES | |
protected $rules = [ | |
ValidatorInterface::RULE_CREATE => [ | |
'email' => 'required|email', | |
'password' => 'required|AlphaNum|Between:4,8', | |
], | |
ValidatorInterface::RULE_UPDATE => [ | |
'email' => 'required|email', | |
'password' => 'required|AlphaNum|Between:4,8', | |
] | |
]; | |
//CUSTOM MESSAGE | |
protected $messages = [ | |
// exemplo: 'email.required' => 'O campo e-mail é obrigatório' | |
'required' => 'O campo :attribute é obrigatório.', | |
'email' => 'O campo :attribute inválido', | |
'AlphaNum' => 'Sua :attribute deve conter letras e números.', | |
'Between' => 'Sua :attribute deve ter de 4 à 8 caracteres' | |
]; | |
//ATTRIBUTES | |
protected $attributes = [ | |
'email' => 'E-mail', | |
'password' => 'Senha' | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment