truongbo / sidebar
Sidebar Admin Package
Installs: 16
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 3
Open Issues: 0
Type:package
Requires
- php: >=7.4
This package is auto-updated.
Last update: 2024-10-30 01:43:01 UTC
README
A simple generate sidebar for PHP/Laravel (Logic only, not include interface as shown below)
Usage :
- 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
Group
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...
Don't forget to add render method to show it on sidebar
Item
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...