阅读(2122) (6)

Laravel 8 在语言文件中自定义信息

2021-06-25 11:53:20 更新

在大多数情况下,您可能选择在语言文件中指定自定义信息,而不是将其传递给 Validator 。您可以在 resources/lang/xx/validation.php 语言文件中的 attributes 数组指定自定义信息来实现:

'custom' => [
    'email' => [
        'required' => 'We need to know your e-mail address!',
    ],
],