The question I want to ask is about how to get the attributes name or display the attributes name with custom validator.
$validator = Validator::make($request->all(), $model->get_update_rules());
$validator->setAttributeNames(["attribute_name" => "Beauty Name"]);
The code above is the code I use to create the validator.
The code below is the code that I use to create Custom Validator.
Validator::extend ( 'custom_validator', function ($attribute, $value, $parameters, $validator) {
return false;
} );
Validator::replacer('custom_validator', function($message, $attribute, $rule, $parameters) {
return str_replace(":other", $parameters[1], $message);
});
the $parameters[1] give me attribute_name instead of Beauty Name. How can i display the Beauty Name in my custom validator?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire