Skip to content

Commit

Permalink
add nested menus II
Browse files Browse the repository at this point in the history
  • Loading branch information
MoamenEltouny committed Mar 17, 2022
1 parent e0192cc commit ca96acb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/MenusServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public function boot()
], ['pharaonic', 'laravel-menus']);

// Blade - Directive
Blade::directive('menu', function ($section) {
return "<?php echo \menu($section, true); ?>";
Blade::directive('menu', function ($data) {
return "<?php echo \menu($data); ?>";
});
}
}
4 changes: 2 additions & 2 deletions src/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
use Pharaonic\Laravel\Menus\Models\Menu;

if (!function_exists('menu')) {
function menu(string $section, bool $view = false)
function menu(string $section, $view = true)
{
$section = Menu::section(trim($section, '\'"'))->get();

if ($section->isEmpty()) return;
if (!$view) return $section;

return view('laravel-menus::section', ['section' => $section]);
return view($view === true ? 'laravel-menus::section' : $view, ['section' => $section]);
}
}

0 comments on commit ca96acb

Please sign in to comment.