virtualorz/sitemap

此包最新版本(0.0.4)没有提供许可信息。

0.0.4 2019-06-27 04:02 UTC

This package is auto-updated.

Last update: 2024-09-29 05:48:37 UTC


README

使用Laravel网络路由生成网站结构,用于父子关系和AdminLte的后台左侧菜单

安装

composer require virtualorz/sitemap

配置

编辑 config/app.php

'providers' => [
    ...
    Virtualorz\Sitemap\SitemapServiceProvider::class
]

'aliases' => [
    ...
    'Sitemap' => Virtualorz\Sitemap\Facades\Sitemap::class,
]

方法

getTreeView
return an Array , the key is parent node name
getNaviPath($pageName = null)
return navipath node array,
if $pageName is null return the current page navi path,
if not return the assign page's navi path
getParents($pageName = null)
return parent node route item,
if $pageName is nul return the current page parent node,
if not return the assign page's parent node
getMenu($parmissionArray = null)
return left side menu structure Array,
if $parmissionArray is null return the full mene
if not return the node in $parmissionArray
routStruct($parent,$sitemap)
return an nested Array for root parent i $parent data from $sitemap,
the $sitemap paremeter is result from getTreeVIew method

route/web.php的示例

Route::get('/customer',
        [
            'as' => 'backend.customer.index' ,// user for id in sitemap
            'uses' => 'backend\CustomerController@index', //controller name
            'parent' => 'backend.index', //parent sitemap id
            'name' => 'Customer List', //customer name for this item
            'label' =>'Data Manage', //backend menu label text for this item
            'fa' => 'fa-database' //backend menu fa icon for this item
        ]);

创建树视图结构的示例

$sitemap = Sitemap::getTreeView();
$sitemap = Sitemap::routStruct('root',$sitemap);

中文版本文件

网站地图:使用Laravel路由生成网站结构数组