51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace app\common\validate\systems;
|
|
|
|
use app\common\validate\BaseValidate;
|
|
|
|
class SystemValidate extends BaseValidate
|
|
{
|
|
|
|
protected $regex = [
|
|
'uri' => '^((https?):\/\/)((?:www\.)|([a-z0-9-_]+\.))?[a-z0-9-_]+(?:\.[a-z]{2,})+(?:\/.*)?$',
|
|
];
|
|
|
|
protected $rule = [
|
|
'id' => 'require',
|
|
'system_name' => 'require|unique:system',
|
|
'system_url' => 'require|uri|unique:system',
|
|
'system_status' => 'require|in:0,1',
|
|
];
|
|
|
|
protected $message = [
|
|
'id.require' => '请选择系统',
|
|
'system_name.require' => '请填写系统名称',
|
|
'system_name' => '系统名称已被使用',
|
|
'system_url.require' => '请填写系统网址',
|
|
'system_url.uri' => '系统网址填写错误',
|
|
'system_url.unique' => '系统网址已被使用',
|
|
'system_status.require' => '请选择系统状态',
|
|
'system_status.in' => '系统状态值错误',
|
|
];
|
|
|
|
public function sceneAdd(): SystemValidate
|
|
{
|
|
return $this->only(['system_name','system_url']);
|
|
}
|
|
|
|
public function sceneEdit(): SystemValidate
|
|
{
|
|
return $this->only(['id','system_name','system_url','system_status']);
|
|
}
|
|
|
|
public function sceneDetail(): SystemValidate
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
public function sceneDelete(): SystemValidate
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
} |