Chron's avatar
Level 6

Default Error messages

I already know about the validation.php that holds all the default error messages for form inputs. But I also noticed there are other files with validation.php; auth.php, pagination.php, and passwords.php. How can I make Laravel use these messages as defaults?

2 likes
4 replies
vincent15000's avatar

Laravel already uses these messages as the default ones.

What are you trying to do exactly ?

1 like
Chron's avatar
Level 6

I'm manually authenticating users. In the docs, it shows that you can pass a custom message to the error bag but I want to use the default messages Laravel provides. Should I just explicitly call __('auth.failed') or is there a way to do this automatically?

1 like
martinbean's avatar

@chron Those other files are there because they hold a purpose. They’re not there just to be used “because”. For example, the auth.php file holds messages for Laravel’s authentication component, and the passwords.php file holds messages for Laravel’s password reset component.

1 like
Mega_Aleksandar's avatar

Hi there,

There is another way of localization -> you can find in detail information here: https://laravel.com/docs/12.x/localization

Basically, you can edit those default files, but I would advise against editing the default files unless your app trully needs (the localization parts).

Best regards

Please or to participate in this conversation.