<?php
/**
* @author 龙虾 <15108148@qq.com>
* @version 2.0 2020-08-06
* @copyright 睿谷信息 <www.rgxx.com>
*/
namespace app\admin\validate;
use think\Validate;

class Navlist extends Validate
{
	
	protected $rule = [
		'name|栏目名称'    => 'require',
        'type|栏目类别'    => 'require',
        'alias|栏目别名'   => 'regex:/^[A-Za-z0-9_]+$/|unique:navlist,site_id^alias|min:3|checkName'
	];


    protected function checkName($value,$rule,$data=[])
    {
    	$arra = ['index','install','admin','user','search','form','downfile'];
    	if(in_array($value,$arra)) {
    		return '自定义URL不能为:'.$value;
    	} else {
    		return true;
    	}
    }
}