Skip to content
On this page

Sidebar Accordion

Dashcode provides sidebar accordion feature.

  • Navigate to resources/views/components/sidebar-menu.blade.php.
  • Add this component. E.g.
php
<x-menu-item :icon-name="'icon-park-outline:system'" 
             :tab-name="'tab_three'" 
             :text="__('Role Permission')">
                @can('menu role_permission_permissions')
                    <x-active-link :active-route="'permissions.*'"
                                   :to="'permissions.index'"
                                   :text="__('Permissions')"/>
                @endcan
                @can('menu role_permission_roles')
                    <x-active-link :active-route="'roles.*'"
                                   :to="'roles.index'"
                                   :text="__('Roles')"/>
                @endcan
</x-menu-item>
  • Give it a unique tab-name.
  • Navigate to app/Helpers/helpers.php and add the routes in getSelected() method, which need to active while clicked the menu. E.g.
php
function getSelected(): string
{
    ...
     elseif (request()->routeIs('roles.*')) {
        return 'tab_three';
    }
    ...
}

Single Menu Item.

  • Navigate to resources/views/components/sidebar-menu.blade.php.
  • Add this component. E.g.
php
<x-menu-item-single :to="'database-backups.index'"
                                :tab-name="'tab_four'"
                                :icon-name="'iconoir:database-backup'"
                                :text="__('Database Backup')"/>
  • Give it a unique tab-name.
  • Navigate to app/Helpers/helpers.php and add the routes in getSelected() method, which need to active while clicked the menu. E.g.
php
function getSelected(): string
{
    ...
     elseif (request()->routeIs('database-backups.*')) {
        return 'tab_four';
    } 
    ...
}

COPYRIGHT © 2022 Codeshaper, All rights reserved.