Wednesday, 15 April 2015

How to add regex to attribute name in custom validations in Laravel? -



How to add regex to attribute name in custom validations in Laravel? -

in custom validation shown below:

'custom' => array( 'attribute-name' => array( 'rule-name' => 'custom-message', ), ),

how possible define regex along attribute-name-{regex} well?!

example:

'custom' => array( 'institute_regex:{/d{1}}' => array( 'required' => 'the field required', ), ),

you're going add together custom message regex rule name. when regex rule defined it's required, need add together language array:

'custom' => array( 'email' => array( 'required' => 'we need know e-mail address!', 'regex' => 'are sure entered right e-mail?!' ), ),

regex laravel laravel-validation

No comments:

Post a Comment