<?php
namespace app\common\model;

use think\Model;

class Menu extends Model
{
	// 设置字段信息
    protected $schema = [
        'id'			=> 'int',
		'pid'			=> 'int',
		'mtype'			=> 'string',
		'title'			=> 'string',
		'layicon'		=> 'tinyint',
		'urlstr'		=> 'string',
		'urlarr'		=> 'string',
		'status'		=> 'tinyint',
        'priority'		=> 'int'
    ];
	
	// 设置字段自动转换类型
	protected $type = [
		'urlarr'		=> 'json'
	]; 
	// 设置JSON数据返回数组
	protected $jsonAssoc = true;

	public function getStatusTextAttr($value,$data)
	{
		$status = [1=>'正常',2=>'禁用'];
		return $status[$data['status']];
	}
	
	
}