Posts

Showing posts with the label respect-validation

Translating or writing custom messages on Respect/Validation

Image
Clash Royale CLAN TAG #URR8PPP Translating or writing custom messages on Respect/Validation I'm using Respect to validate some forms in a project but this project is in Spanish and I don't understand how messages work after spending a long time reading the documentation and even its code. I'm using Slim and I'm using a NestedValidationException following an example I read on a tutorial on Youtube. This is the validate method: public function validate($request, array $rules) { foreach ($rules as $field => $rule) { try { $rule->setName(ucfirst($field))->assert($request->getParam($field)); } catch (NestedValidationException $e) { $e->findMessages([ 'usernameAvailable' => '{{name}} ya existe en la base de datos', 'emailAvailable' => '{{name}} ya existe en la base de datos', 'notEmpty'...