示例#1
0
 /**
  * Render a menu structure from the database
  *
  * @param string $menukey
  * @return string|null
  */
 public function make($menukey)
 {
     $menukey = Str::slug($menukey);
     $menu = Menu::where('slug', '=', $menukey)->first();
     $renderer = new LavarySidebarRenderer();
     return $renderer->renderToHtml($menu);
 }
示例#2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     // Find the menu -- searching by slug is a good way to identify
     // menus.
     /** @var Menu $menu */
     $menu = Menu::where('slug', '=', 'example-menu')->first();
     // Create the renderer.
     $renderer = new LavarySidebarRenderer();
     // Use the renderer to render the menu to HTML.
     $rendered = $renderer->renderToHtml($menu);
     // Output the HTML to the console just as an example.
     $this->output->writeln($rendered);
 }