<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-present http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace app\admin\model;

use app\admin\service\AdminMenuService;
use think\Model;
use think\facade\Cache;

class AdminMenuModel extends Model
{
    /**
     * 模型名称
     * @var string
     */
    protected $name = 'admin_menu';

    /**
     * 按父ID查找菜单子项
     * @param int     $parentId 父菜单ID
     * @param boolean $withSelf 是否包括他自己
     * @return array|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     * @deprecated
     */
    public function adminMenu($parentId, $withSelf = false)
    {
        return AdminMenuService::adminMenu($parentId, $withSelf);
    }

    /**
     * 获取菜单 头部菜单导航
     * @param string $parentId 菜单id
     * @param bool   $bigMenu
     * @return array|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     * @deprecated
     */
    public function subMenu($parentId = '', $bigMenu = false)
    {
        return AdminMenuService::subMenu($parentId, $bigMenu);
    }

    /**
     * @deprecated
     * 菜单树状结构集合
     */
    public function menuTree()
    {
        return AdminMenuService::menuTree();
    }

    /**
     * 取得树形结构的菜单
     * @param        $myId
     * @param string $parent
     * @param int    $Level
     * @return bool|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     * @deprecated
     */
    public function getTree($myId, $parent = "", $Level = 1)
    {
        return AdminMenuService::getTree($myId, $parent, $Level);
    }

    /**
     * 更新缓存
     * @param null $data
     * @return array|null
     * @deprecated
     */
    public function menuCache($data = null)
    {
        return AdminMenuService::menuCache($data);
    }

    /**
     * @param $parentId
     * @param $withSelf
     * @return AdminMenuModel[]|array|\think\Collection
     * @deprecated
     */
    public function menu($parentId, $withSelf = false)
    {
        return AdminMenuService::menu($parentId, $withSelf);
    }

    /**
     * 得到某父级菜单所有子菜单，包括自己
     * @param int $parentId
     * @return array|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     * @deprecated
     */
    public function getMenuTree($parentId = 0)
    {
        return AdminMenuService::getMenuTree($parentId);
    }

}
