腾讯云优惠券

呆错后台管理框架基础模块(后台菜单)开发实例

人气:598 更新:2022-02-26

初始字段

$fields = [
    'term_name'        => '菜单',//菜单名称
    'term_slug'        => 'admin/index/index',//菜单链接
    'term_info'        => 'fa-check',//菜单ICO
    'term_module'      => 'admin',//应用名
    'term_controll'    => 'menus',//固定值
    'term_action'      => 'left',//操作名(top|left)
    'term_status'      => 'normal',//状态
    'term_type'        => '_self',//打开方式
    'term_order'       => 1,
    'term_parent'      => 0,
    'term_count'       => 0,
    'term_title'       => '',
    'term_kewords'     => '',
    'term_description' => '',
];

卸载插件时删除后台菜单

model('common/Menu','loglic')->uninstall('demo'); 

安装插件时批量插入一级菜单(顶部与左侧)

model('common/Menu','loglic')->install([
    [
        'term_name'     => '顶部菜单',
        'term_slug'     => 'demo/index/index',
        'term_info'     => 'fa-gear',
        'term_type'     => '_self',
        'term_action'   => 'top',
        'term_module'   => 'demo',
    ],
    [
        'term_name'     => '菜单演示',
        'term_slug'     => 'demo',
        'term_info'     => 'fa-home',
        'term_type'     => '_self',
        'term_action'   => 'left',
        'term_module'   => 'demo',
    ]
]);

安装插件时批量插入二级菜单(左侧)

model('common/Menu','loglic')->install([
    [
        'term_name'     => '测试1',
        'term_slug'     => 'demo/index/index',
        'term_info'     => 'fa-gear',
        'term_type'     => '_self',
        'term_action'   => 'left',
        'term_module'   => 'demo',
    ],
    [
        'term_name'     => '测试2',
        'term_slug'     => 'demo/left/index',
        'term_info'     => 'fa-home',
        'term_type'     => '_self',
        'term_action'   => 'left',
        'term_module'   => 'demo',
    ]
],'菜单演示');