// +---------------------------------------------------------------------- namespace app\admin\Model; use think\Model; use think\facade\Cache; /** * 权限规则模型 */ class AuthRule extends Model { const RULE_URL = 1; const RULE_MAIN = 2; //主菜单 // 自动写入时间戳 protected $autoWriteTimestamp = true; protected static function init() { self::afterWrite(function ($row) { Cache::rm('__menu__'); }); } }