philipnjuguna/menu-generator

A simple package to generate sidebar for admin dashboard, preset for adminLte

2.0.1 2021-01-22 12:52 UTC

This package is auto-updated.

Last update: 2024-04-17 09:10:59 UTC


README

Total Downloads Total Downloads Latest Stable Version License

A simple laravel package to generate side menu for admin dashboard, with permission

Already preset with adminLte stylesheet

Installation

composer require philipnjuguna/menu-generator:dev-main

Menu will be generated like below:

Example

 {!!
       Menu::module('Manage Clients', ['view_clients'])
                ->section('client')
                ->icon('fa fa-user')
                ->menu('Clients', route('client.index'),'browse_clients')
                ->output()
       !!}

Menu with level two is generated like below

  {!!
           Menu::module('Menu Item', ['array_of_permissions'])
                ->section('section')
                ->icon('fa fa-area-chart')
                ->subModules([[
                        "name"  => "Child 1",
                        "permission" => 'child_1_permissions',
                        "children" => [
                                        ["item" => "Expense ", "uri" => route('expenses.index') , "permission" =>"create_expenses"],
                                        ["item" => "category ", "uri" => route('category.index') , "permission" =>"create_category"],
                                       
                                 ],
                        ],
                        [
                        "name"  => "Purchases",
                        "permission" => 'show_requisition_account',
                        "children" => [
                                        ["item" => "Vendor", "uri" => route('vendor.index') , "permission" => "show_vendors"],
                                        ["item" => "Bills", "uri" => route('bill.index') , "permission" =>"show_bills"],
                                        ["item" => "Make Payments", "uri" => route('make_payment.index') , "permission" =>"make_payments"],
                                 ],
                        ],
                        ])
                        ->output()
       !!}


Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT