1. In Laravel’s form validation, the error messages contain English text, primarily the validated attribute name: winning limit. See Figure 1.

JSON
{
"code": 10000,
"message": "winning limit 必须是整数。",
"data": []
}
2. The validation code is as follows:
PHP
$input = $request->json()->all();
Arr::set($input, 'activity_id', $activityId);
$factory = Container::getInstance()->make('validator');
$validator = $factory->make($input, [
'activity_id' => 'required|uuid|exists:activities,id',
'prize_id' => 'required|uuid|exists:prizes,id',
'winning_limit' => 'integer',
'stock_limit' => 'numeric',
'winning_probability' => 'numeric|between:0,1',
]);
3. Reference URL: https://learnku.com/docs/laravel/5.4/validation/1234#42c1ed . Customizing attributes in the language file. If you want to replace the :attribute portion of the validation message with a custom attribute name, you can specify the custom name in the attributes array of the resources/lang/xx/validation.php language file. Edit: resources/lang/zh-CN/validation.php
PHP
'attributes' => [
'winning_limit' => '中奖限制',
],
4. In Laravel’s form validation, the attribute name in the error message: winning limit has been replaced with: 中奖限制. This matches expectations. See Figure 2.

JSON
{
"code": 10000,
"message": "中奖限制 必须是整数。",
"data": []
}
