search

Home  >  Q&A  >  body text

Passing locale to Laravel validator: is this possible?

In my laravel controller I validate the request like this:

$validatedData = $request->validate(UserValidator::$updateIfNeeded);

Now, is it possible to pass a locale string to the validator, like "es" or "en"?

P粉792673958P粉792673958275 days ago439

reply all(1)I'll reply

  • P粉226642568

    P粉2266425682024-03-27 16:03:33

    There is no need to do this, Laravel's built-in validation rules each have an error message, which is located in your application's lang/en/validation.php file. In this file you will find translation entries for each validation rule. You are free to change or modify these messages according to the needs of your application.

    Also, you can...%8

    reply
    0
  • Cancelreply