创建模型验证器,验证数据正确性
This commit is contained in:
25
app/common/validate/AgentSettlementPeriod.php
Normal file
25
app/common/validate/AgentSettlementPeriod.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class AgentSettlementPeriod extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'settlement_no' => 'require|max:64|unique:agent_settlement_period',
|
||||
'period_start_at' => 'require|integer|egt:0',
|
||||
'period_end_at' => 'require|integer|egt:0',
|
||||
'status' => 'in:0,1,2',
|
||||
'remark' => 'max:255',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['settlement_no', 'period_start_at', 'period_end_at', 'status', 'remark'],
|
||||
'edit' => ['period_start_at', 'period_end_at', 'status', 'remark'],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user