我需要数字验证gte:5,但也允许0
Laravel 8
已尝试'price' => 'nullable|numeric|gte:5',但需要在发送时允许0
发布于 2021-09-02 07:56:39
您必须创建自定义规则(informations here)。
这里:
Validator::extend('price_custom', function($attribute, $value){
return $value === 0 || $value >= 5;
});然后:
'price' => 'nullable|numeric|price_custom'https://stackoverflow.com/questions/69026053
复制相似问题