{"id":20179819,"url":"https://github.com/mnestorov/laravelmenu","last_synced_at":"2025-05-07T02:30:37.680Z","repository":{"id":64250821,"uuid":"574438312","full_name":"mnestorov/laravelmenu","owner":"mnestorov","description":"Drag and drop menu generator for Laravel.","archived":true,"fork":false,"pushed_at":"2022-12-05T14:54:03.000Z","size":52,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-03T05:42:48.387Z","etag":null,"topics":["bootstrap","laravel","laravel-package","menu","menu-generator","php"],"latest_commit_sha":null,"homepage":"","language":"Blade","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mnestorov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-12-05T10:08:54.000Z","updated_at":"2024-11-04T17:26:43.000Z","dependencies_parsed_at":"2023-01-15T06:45:21.959Z","dependency_job_id":null,"html_url":"https://github.com/mnestorov/laravelmenu","commit_stats":null,"previous_names":["mnestorov/laravelmenu","smartystudio/laravelmenu"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnestorov%2Flaravelmenu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnestorov%2Flaravelmenu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnestorov%2Flaravelmenu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnestorov%2Flaravelmenu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mnestorov","download_url":"https://codeload.github.com/mnestorov/laravelmenu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252801260,"owners_count":21806283,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bootstrap","laravel","laravel-package","menu","menu-generator","php"],"created_at":"2024-11-14T02:28:18.738Z","updated_at":"2025-05-07T02:30:37.669Z","avatar_url":"https://github.com/mnestorov.png","language":"Blade","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Drag and Drop menu generator for Laravel\n\nAn admin interface for [Laravel](https://laravel.com) to easily add, edit or remove Menus.\n\n## Install\n\n1. In your terminal:\n\n```bash\ncomposer require smartystudio/laravelmenu\n```\n\n**_Step 2 \u0026 3 are optional if you are using laravel 5.5_**\n\n2. If your Laravel version does not have package autodiscovery then add the service provider to your config/app.php file:\n\n```php\nSmartyStudio\\LaravelMenu\\MenuServiceProvider::class,\n```\n\n3. Add facade in the file config/app.php (optional on laravel 5.5):\n\n```php\n'Menu' =\u003e SmartyStudio\\LaravelMenu\\Facades\\Menu::class,\n```\n\n4. Publish the config file \u0026 run the migrations.\n\n```bash\nphp artisan vendor:publish --provider=\"SmartyStudio\\LaravelMenu\\MenuServiceProvider\"\n```\n\n5. Configure (optional) in `config/laravelmenu.php`:\n\n- **_CUSTOM MIDDLEWARE:_** You can add you own middleware\n- **_TABLE PREFIX:_** By default this package will create 2 new tables named \"menus\" and \"menu_items\" but you can still add your own table prefix avoiding conflict with existing table\n- **_TABLE NAMES_** If you want use specific name of tables you have to modify that and the migrations\n- **_Custom routes_** If you want to edit the route path you can edit the field\n- **_Role Access_** If you want to enable roles (permissions) on menu items\n\n6. Run the database migrations:\n\n```bash\nphp artisan migrate\n```\n\nDONE!\n\n## Menu Builder Usage Example - displays the builder\n\nOn your view blade file\n\n```php\n@extends('app')\n\n@section('contents')\n    {!! Menu::render() !!}\n@endsection\n```\n\n**You must have jQuery loaded before menu scripts**\n\n```php\n@push('scripts')\n    {!! Menu::scripts() !!}\n@endpush\n```\n\n## Using the Model\n\nCall the model class:\n\n```php\nuse SmartyStudio\\LaravelMenu\\Models\\Menu;\nuse SmartyStudio\\LaravelMenu\\Models\\MenuItem;\n```\n\n## Menu Usage Example (a)\n\nA basic two-level menu can be displayed in your blade template.\n\n### Using Model class\n\n```php\n// Get menu by ID\n$menu = Menu::find(1);\n\n// Get menu by Name\n$menu = Menu::where('name','Test Menu')-\u003efirst();\n\n/**\n * Get menu by Name and the Items with eager loading.\n * This is RECOMENDED for better performance and less query calls.\n */\n$menu = Menu::where('name','Test Menu')-\u003ewith('items')-\u003efirst();\n\n// Get menu by ID\n$menu = Menu::where('id', 1)-\u003ewith('items')-\u003efirst();\n\n// Access by Model result\n$public_menu = $menu-\u003eitems;\n\n// Convert it to Array\n$public_menu = $menu-\u003eitems-\u003etoArray();\n```\n\n### Using Helper class\n```php\n// Using Helper \n$public_menu = Menu::getByName('Public'); // return array\n```\n\n## Menu Usage Example (b)\n\nNow inside your blade template file, place the menu using this simple example:\n\n```html\n\u003cdiv class=\"nav-wrap\"\u003e\n    \u003cdiv class=\"btn-menu\"\u003e\n        \u003cspan\u003e\u003c/span\u003e\n    \u003c/div\u003e\u003c!-- // mobile menu button --\u003e\n    \u003cnav id=\"mainnav\" class=\"mainnav\"\u003e\n        @if($public_menu)\n            \u003cul class=\"menu\"\u003e\n                @foreach($public_menu as $menu)\n                    \u003cli class=\"\"\u003e\n                        \u003ca href=\"{{ $menu['link'] }}\" title=\"\"\u003e{{ $menu['label'] }}\u003c/a\u003e\n                        @if( $menu['child'] )\n                        \u003cul class=\"sub-menu\"\u003e\n                            @foreach( $menu['child'] as $child )\n                                \u003cli class=\"\"\u003e\u003ca href=\"{{ $child['link'] }}\" title=\"\"\u003e{{ $child['label'] }}\u003c/a\u003e\u003c/li\u003e\n                            @endforeach\n                        \u003c/ul\u003e\u003c!-- /.sub-menu --\u003e\n                        @endif\n                    \u003c/li\u003e\n                @endforeach\n            \u003c!-- empty --\u003e\n        @endif\n        \u003c/ul\u003e\u003c!-- /.menu --\u003e\n    \u003c/nav\u003e\u003c!-- /#mainnav --\u003e\n \u003c/div\u003e\u003c!-- /.nav-wrap --\u003e\n```\n\n### HELPERS\n\n### Get Menu Items By Menu ID\n\n```php\nuse SmartyStudio\\LaravelMenu\\Facades\\Menu;\n...\n/**\n * Parameter: Menu ID\n * Return:    Array\n */\n$menuList = Menu::get(1);\n```\n\n### Get Menu Items By Menu Name\n\nIn this example, you must have a menu named _Admin_\n\n```php\nuse SmartyStudio\\LaravelMenu\\Facades\\Menu;\n...\n/**\n * Parameter: Menu ID\n * Return:    Array\n */\n$menuList = Menu::getByName('Admin');\n```\n\n### Customization of the menu\n\nYou can publish and edit the menu layout in `resources/views/vendor/smartystudio/laravelmenu/menu.blade.php`\n\n## Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Testing\n\n``` bash\n// TODO\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email us instead of using the issue tracker.\n\n## Credits\n\n- Martin Nestorov - Web Developer @ Smarty Studio.\n- All Contributors\n\n## License\n\nThe SmartyStudio\\LaravelMenu is open-source software licensed under the MIT license.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnestorov%2Flaravelmenu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmnestorov%2Flaravelmenu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnestorov%2Flaravelmenu/lists"}