郎
"Min_UserName" => "Min :chars chars for username",
JQuery的
$("form#registerForm").validate({
rules: {
UserName: {
required: true,
minlength: 6
}
},
messages: {
UserName: {
required: "{!! trans('Register.Required_UserName') !!}",
minlength: "{!! trans('Register.Min_UserName',
['chars' => '\App\UserMinValue::Min_UserName']) !!}"
}
}
});
类
namespace App\Architecture\MinMaxValues;
class UserMinValue {
const Min_UserName = 6;
}
当前输出
minlength: "Min App\UserMinValue::Min_UserName chars for username",
预期输出
minlength: "Min 6 chars for username",
我错过了什么吗?
答案 0 :(得分:1)
您在类路径周围有引号,因此发出字符串路径而不是您需要的值,更改:
['chars' => '\App\UserMinValue::Min_UserName']
要:
['chars' => \App\UserMinValue::Min_UserName]