LARAVEL CUSTOM VALIDATION
NID Validation :)
1> app/Providers/AppServiceProvider.php
public function boot(){
$this->app['validator']->extend('nid',function($attribute,$value,$parameters){
$length = strlen($value);
if(in_array($length,[10,13,17])){
return true;
}else{
return false;
}
});
}
2> resources/lang/en/validation.php
return [
'nid' => 'The :attribute valid NID must be 10 | 13 | 17',
];
1> app/Providers/AppServiceProvider.php
public function boot(){
$this->app['validator']->extend('nid',function($attribute,$value,$parameters){
$length = strlen($value);
if(in_array($length,[10,13,17])){
return true;
}else{
return false;
}
});
}
2> resources/lang/en/validation.php
return [
'nid' => 'The :attribute valid NID must be 10 | 13 | 17',
];
Comments
Post a Comment