truongbo/sidebar

There is no license information available for the latest version (dev-main) of this package.

Sidebar Admin Package

dev-main 2022-11-03 02:25 UTC

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 of ServiceProvider

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

Group

  • setLabel : set label name for group
  • setPosition : set position for group
  • setIcon : set icon for group
  • setClass : set class for group
  • setStyleCss : 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 item
  • setPosition : set position for item
  • setIcon : set icon for item
  • setClass : set class for item
  • setStyleCss : set custom style css for item
    • anymore...

Don't forget to add render method to show it on sidebar