A simple generate sidebar for PHP/Laravel (Logic only, not include interface as shown below)
- Install
composer require truongbo/sidebar
-
Use
- Register in method
boot
ofServiceProvider
- Register in method
Example in method boot
of AppServiceProvider
:
// Register group sidebar
\SideBarDashBoard::registerGroup('permission_manager')
->setLabel('Authentication')
->setPosition(99)
->setIcon('nav-icon la la-users')
->render();
// Register item in group permission_manager sidebar
\SideBarDashBoard::registerItem('user')
->setLabel('Users')
->setPosition(1)
->setRoute(bo_url('user'))
->setIcon('nav-icon la la-user')
->setGroup('permission_manager')
->render();
// Register item in group permission_manager sidebar
\SideBarDashBoard::registerItem('role')
->setLabel('Roles')
->setPosition(2)
->setRoute(bo_url('role'))
->setIcon('nav-icon la la-id-badge')
->setGroup('permission_manager')
->render();
// Register item in group permission_manager sidebar
\SideBarDashBoard::registerItem('permission')
->setLabel('Permission')
->setPosition(3)
->setRoute(bo_url('permission'))
->setIcon('nav-icon la la-key')
->setGroup('permission_manager')
->render();
- Show sidebar
- Example show result in file
sidebar.blade.php
- Example show result in file
setLabel
: set label name for groupsetPosition
: set position for groupsetIcon
: set icon for groupsetClass
: set class for groupsetStyleCss
: set custom style css for group- anymore...
setGroup
: set group for item (by key group)setLabel
: set label name for itemsetPosition
: set position for itemsetIcon
: set icon for itemsetClass
: set class for itemsetStyleCss
: set custom style css for item- anymore...