PHP code example of tasmir / sidebar-manager
1. Go to this page and download the library: Download tasmir/sidebar-manager library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tasmir / sidebar-manager example snippets
return [
'menu' => [
'marketing' => [
'category' => 'Marketing',
'order' => 50,
'items' => [
'campaigns' => [
'label' => 'Campaigns',
'route' => 'admin.marketing.campaigns',
'icon' => '<svg>...</svg>',
'permission' => 'campaigns_list',
],
],
],
],
// Remove default items or categories
'remove' => [
'dashboard', // Removes the entire dashboard category
'system' => ['activity'], // Removes only the 'activity' item from 'system'
],
];
use Sidebar;
// Add a category
Sidebar::category('settings', [
'category' => 'Settings',
'order' => 100,
]);
// Add an item fluently
Sidebar::item('settings', 'profile', [
'label' => 'My Profile',
'route' => 'admin.profile.edit',
'icon' => '<svg>...</svg>',
]);
// Extending an existing group from another module
Sidebar::item('marketing', 'newsletter', [
'label' => 'Newsletter',
'route' => 'admin.marketing.newsletter',
'icon' => '<svg>...</svg>',
'order' => 10, // Items will be sorted by this order
]);
// Remove an item
Sidebar::removeItem('system', 'activity');
// Remove an entire category
Sidebar::removeCategory('dashboard');
bash
php artisan vendor:publish --tag="config"