2023-09-18 09:11:13 +08:00
|
|
|
<?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',
|
2023-09-19 09:18:45 +08:00
|
|
|
'name' => 'require|unique:system',
|
|
|
|
'url' => 'require|uri|unique:system',
|
|
|
|
'status' => 'require|in:0,1',
|
2023-09-18 09:11:13 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
protected $message = [
|
|
|
|
'id.require' => '请选择系统',
|
2023-09-19 09:18:45 +08:00
|
|
|
'name.require' => '请填写系统名称',
|
|
|
|
'name' => '系统名称已被使用',
|
|
|
|
'url.require' => '请填写系统网址',
|
|
|
|
'url.uri' => '系统网址填写错误',
|
|
|
|
'url.unique' => '系统网址已被使用',
|
|
|
|
'status.require' => '请选择系统状态',
|
|
|
|
'status.in' => '系统状态值错误',
|
2023-09-18 09:11:13 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
public function sceneAdd(): SystemValidate
|
|
|
|
{
|
2023-09-19 09:18:45 +08:00
|
|
|
return $this->only(['name','url']);
|
2023-09-18 09:11:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public function sceneEdit(): SystemValidate
|
|
|
|
{
|
2023-09-19 17:07:54 +08:00
|
|
|
return $this->only(['id','name','url','status']);
|
2023-09-18 09:11:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public function sceneDetail(): SystemValidate
|
|
|
|
{
|
|
|
|
return $this->only(['id']);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function sceneDelete(): SystemValidate
|
|
|
|
{
|
|
|
|
return $this->only(['id']);
|
|
|
|
}
|
|
|
|
}
|