简体   繁体   English

如何在流明中添加自定义验证数组文件

[英]how to add custom validaton array file in lumen

we have resources/lang directory in laravel so we can add our language directory in that and add validation.php and use that for translation of validation error messages but that does not exist in lumen, so how we can add our array of whole custom validation messages to auto use by laravel我们在 laravel 中有 resources/lang 目录,所以我们可以在其中添加我们的语言目录并添加 validation.php 并使用它来翻译验证错误消息,但流明中不存在,所以我们如何添加我们的整个自定义验证数组laravel 自动使用的消息

To do so, add your messages to custom array in the resources/lang/xx/validation.php language file.为此,请将您的消息添加到 resources/lang/xx/validation.php 语言文件中的自定义数组中。

Add custom email validation message:添加自定义 email 验证消息:

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

Check lumen validation docs: https://lumen.laravel.com/docs/5.1/validation检查流明验证文档: https://lumen.laravel.com/docs/5.1/validation

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM