PHP code example of caydeesoft / menu-manager

1. Go to this page and download the library: Download caydeesoft/menu-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/ */

    

caydeesoft / menu-manager example snippets


return [
    'menus' => [
        'sidebar' => [
            'view' => [
                'wrapper' => [
                    'tag' => 'ul',
                    'class' => 'sidebar-nav',
                    'attributes' => [
                        'role' => 'list',
                    ],
                ],
                'header' => [
                    'tag' => 'li',
                    'class' => 'sidebar-header',
                    'attributes' => [
                        'role' => 'presentation',
                    ],
                ],
                'item' => [
                    'tag' => 'li',
                    'class' => 'sidebar-item',
                    'active_class' => 'active',
                ],
                'link' => [
                    'class' => 'sidebar-link',
                ],
                'icon' => [
                    'tag' => 'i',
                    'class' => 'align-middle',
                ],
                'label' => [
                    'tag' => 'span',
                    'class' => 'align-middle',
                ],
            ],
            'items' => [
                [
                    'type' => 'header',
                    'title' => 'Main',
                    'position' => 1,
                ],
                [
                    'type' => 'item',
                    'title' => 'Dashboard',
                    'route' => 'backend.admin_dashboard',
                    'icon' => 'fas fa-home',
                    'position' => 2,
                ],
            ],
        ],
    ],
];

[
    'type' => 'header',
    'title' => 'Revenue',
    'position' => 20,
],

[
    'type' => 'item',
    'title' => 'Transactions',
    'route' => 'backend.transaction.index',
    'icon' => 'fas fa-dollar-sign',
    'permission' => 'view_transaction',
    'position' => 22,
],

[
    'type' => 'item',
    'title' => 'Activity Log',
    'route' => 'backend.logs.index',
    'params' => [
        'user' => 1,
    ],
    'icon' => 'fas fa-pen',
    'position' => 41,
],

[
    'type' => 'dropdown',
    'title' => 'Settings',
    'icon' => 'fas fa-tools',
    'permission' => 'view_settings',
    'position' => 50,
    'children' => [
        [
            'type' => 'item',
            'title' => 'General',
            'route' => 'backend.settings.general',
            'permission' => 'view_settings',
            'position' => 1,
        ],
    ],
],

'dropdown' => [
    'tag' => 'li',
    'class' => 'sidebar-item',
    'toggle' => [
        'class' => 'sidebar-link collapsed',
        'attributes' => [
            'data-bs-toggle' => 'collapse',
            'aria-expanded' => 'false',
        ],
    ],
    'children' => [
        'tag' => 'ul',
        'class' => 'sidebar-dropdown list-unstyled collapse',
        'attributes' => [
            'role' => 'list',
        ],
    ],
],

[
    'type' => 'html',
    'html' => '<li class="nav-item"><button type="button" class="btn btn-theme-toggle">Light</button></li>',
    'position' => 1,
],

[
    'type' => 'item',
    'title' => 'Dashboard',
    'route' => 'backend.admin_dashboard',
    'icon' => 'fas fa-home',
    'item_class' => 'sidebar-item custom-item',
    'link_class' => 'sidebar-link custom-link',
    'icon_class' => 'align-middle text-primary',
    'label_class' => 'align-middle fw-bold',
    'link_attributes' => [
        'data-turbo' => 'false',
    ],
    'position' => 2,
],
bash
php artisan vendor:publish --tag=menu-manager-config
text
config/menu-manager.php
text
vendor/caydeesoft/menu-manager/src/config/menu-manager.php
text
src/config/menu-manager.php
bash
php artisan vendor:publish --tag=menu-manager-views
text
resources/views/vendor/menu-manager/menu.blade.php
resources/views/vendor/menu-manager/sidebar.blade.php
resources/views/vendor/menu-manager/top.blade.php
resources/views/vendor/menu-manager/partials/items.blade.php
resources/views/vendor/menu-manager/partials/attributes.blade.php