Files
xin-procurement/app/Http/Requests/Purchase/PurchaseItemUpdateRequest.php
T
2026-07-23 20:41:25 +08:00

40 lines
1.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Http\Requests\Purchase;
use Modules\Common\Http\Requests\BaseFormRequest;
/**
* 采购明细修改 验证(C4amount 由后端按 weight>0 ? weight×price : quantity×price 重算)
*/
class PurchaseItemUpdateRequest extends BaseFormRequest
{
protected $stopOnFirstFailure = true;
public function rules(): array
{
return [
'product_name' => 'nullable|string|max:100',
'product_spec' => 'nullable|string|max:100',
'price' => 'required|numeric|min:0',
'quantity' => 'required|numeric|min:0',
'weight' => 'nullable|numeric|min:0',
'remark' => 'nullable|string|max:255',
];
}
public function messages(): array
{
return [
'price.required' => '采购单价不能为空',
'price.numeric' => '采购单价必须为数字',
'price.min' => '采购单价不能小于 0',
'quantity.required' => '采购量不能为空',
'quantity.numeric' => '采购量必须为数字',
'quantity.min' => '采购量不能小于 0',
'weight.numeric' => '实际称重必须为数字',
'weight.min' => '实际称重不能小于 0',
];
}
}