Skip to content

Instantly share code, notes, and snippets.

@ivansostarko
Last active June 10, 2019 19:06
Show Gist options
  • Save ivansostarko/3050346ae0a206a8456dcde9b26bfbf6 to your computer and use it in GitHub Desktop.
Save ivansostarko/3050346ae0a206a8456dcde9b26bfbf6 to your computer and use it in GitHub Desktop.
Laravel Modules extended Menu (https://github.com/nWidart/laravel-modules)
@foreach(Module::all() as $module)
{!! ModulesMenu::generateMenu($module->alias) !!}
@endforeach
/** Create menu.blade.php in Module resources folder **/
<ul>
<li><a href="#"> Menu 1</a>
<li><a href="#"> Menu 2</a>
<li><a href="#"> Menu 3</a>
</ul>
<?php
namespace App\Helpers;
/**
* Class ModulesMenu
*
* Render Menu for blade template
*
* @package App\Helpers
*/
class ModulesMenu
{
/**
* Generate Menu
*
*
* @return mixed
*
*/
public static function generateMenu($alias)
{
$return = $alias.'::menu';
return view($return)->render();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment