first commit
This commit is contained in:
47
application/common/validate/Menu.php
Normal file
47
application/common/validate/Menu.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
// +------------------------------------------------+
|
||||
// |http://www.cjango.com |
|
||||
// +------------------------------------------------+
|
||||
// | 修复BUG不是一朝一夕的事情,等我喝醉了再说吧! |
|
||||
// +------------------------------------------------+
|
||||
// | Author: 小陈叔叔 <Jason.Chen> |
|
||||
// +------------------------------------------------+
|
||||
namespace app\common\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 菜单验证器
|
||||
*/
|
||||
class Menu extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'title' => 'require|max:32',
|
||||
'sort' => 'number',
|
||||
'url' => 'requireWith:pid|max:30',
|
||||
];
|
||||
|
||||
/**
|
||||
* 错误提示消息
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'title.require' => '菜单名称必须填写',
|
||||
'title.max' => '菜单名称不应大于:rule字符',
|
||||
'sort.number' => '排序必须是数字',
|
||||
'url.requireWith' => '菜单URL连接必须填写',
|
||||
'url.max' => '菜单URL最大长度:rule字符',
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证场景
|
||||
* @var array
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => ['title', 'sort', 'url'],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user