37 lines
1.0 KiB
PHP
37 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Purchase;
|
|
|
|
use Modules\Common\Http\Requests\BaseFormRequest;
|
|
|
|
/**
|
|
* 采购明细门店单元格修改 验证(C4;amount = 数量×单价 由后端重算)
|
|
*/
|
|
class PurchaseCellUpdateRequest extends BaseFormRequest
|
|
{
|
|
protected $stopOnFirstFailure = true;
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'quantity' => 'required|integer|min:0',
|
|
'price' => 'required|numeric|min:0',
|
|
'weight' => 'nullable|numeric|min:0',
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'quantity.required' => '数量不能为空',
|
|
'quantity.integer' => '数量必须为整数',
|
|
'quantity.min' => '数量不能小于 0',
|
|
'price.required' => '单价不能为空',
|
|
'price.numeric' => '单价必须为数字',
|
|
'price.min' => '单价不能小于 0',
|
|
'weight.numeric' => '实际称重必须为数字',
|
|
'weight.min' => '实际称重不能小于 0',
|
|
];
|
|
}
|
|
}
|