创建模型验证器,验证数据正确性
This commit is contained in:
26
app/common/validate/Channel.php
Normal file
26
app/common/validate/Channel.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Channel extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'code' => 'require|max:255|unique:channel',
|
||||
'name' => 'require|max:255',
|
||||
'agent_mode' => 'require|in:turnover,affiliate',
|
||||
'status' => 'in:0,1',
|
||||
'admin_id' => 'require|integer|gt:0',
|
||||
'remark' => 'max:255',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['code', 'name', 'agent_mode', 'status', 'admin_id', 'remark'],
|
||||
'edit' => ['name', 'agent_mode', 'status', 'admin_id', 'remark'],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user