1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace app\common\validate;
- use think\Db;
- use think\Validate;
- class Document extends Validate{
- protected $rule = [
- 'title|文档名称' => 'require',
- 'cate_id|文档分类' => 'require|gt:0',
- 'auth' => 'checkAuth',
- ];
- protected $message = [
- 'cate_id.gt' => '未选择文档分类',
- 'cate_id.require' => '未选择文档分类',
- ];
- protected $scene = [
- ];
- protected function checkAuth($value,$rule,$data=[])
- {
- if($value === 3 && !$data['auths']){
- return '未选择查看范围';
- }
- return true;
- }
- }
|