You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
922 B
44 lines
922 B
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Request\v3;
|
|
|
|
use App\Request\BaseFormRequest;
|
|
|
|
class ShopCartUpdateRequest extends BaseFormRequest
|
|
{
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'goods_id' => 'required|nonempty|integer',
|
|
'num' => 'required|nonempty|integer',
|
|
'user_id' => 'required|nonempty|integer|exists:lanzu_user,id',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'user_id.*' => ':attribute无效',
|
|
'goods_id.*' => ':attribute无效',
|
|
'num.*' => ':attribute无效',
|
|
];
|
|
}
|
|
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'user_id' => '用户id',
|
|
'goods_id' => '商品ID',
|
|
'num' => '数量',
|
|
];
|
|
}
|
|
}
|