1. Go to this page and download the library: Download javaabu/menu-builder 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/ */
$sidebar = new \App\Menus\AdminSidebar();
{!! $sidebar->links() !!}
// render as Bootstrap 5
{!! $sidebar->useBootstrap5()->links() !!}
// render as Material Admin 2.6
{!! $sidebar->useMaterialAdmin26()->links() !!}
use Javaabu\MenuBuilder\MenuBuilder;
/**
* Bootstrap any application services.
*/
public function boot(): void
{
MenuBuilder::useBootstrap5();
MenuBuilder::useMaterialAdmin26();
}
// render using custom view
{!! $sidebar->links('web.menus.sidebar') !!}
$item->getLink() // returns the link of the item
$item->getLabel() // returns the label of the item
$item->isActive() // checks if the item is currently active
$item->hasActiveChild($user) // checks if the item has any visible child that is currently active
$item->hasIcon() // checks if the item has an icon defined
$item->getIcon($icon_prefix) // returns the item's icon with the prefix prepended
$item->hasCssClass() // checks if the items has a custom css class set
$item->getCssClass() // returns the custom css class, if any set for the item
$item->getAggregatedCount($user) // get the count of the item + the count of all visible child items, will return 0 if the current user can't see the count
$item->getVisibleCount($user) // get the count of the item, will return 0 if the current user can't see the count
$item->getVisibleChildren($user) // returns an array of all visible child items