Skip to content

Commit ca96acb

Browse files
author
Moamen Eltouny
committed
add nested menus II
1 parent e0192cc commit ca96acb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/MenusServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public function boot()
3838
], ['pharaonic', 'laravel-menus']);
3939

4040
// Blade - Directive
41-
Blade::directive('menu', function ($section) {
42-
return "<?php echo \menu($section, true); ?>";
41+
Blade::directive('menu', function ($data) {
42+
return "<?php echo \menu($data); ?>";
4343
});
4444
}
4545
}

src/helper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
use Pharaonic\Laravel\Menus\Models\Menu;
44

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

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

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

0 commit comments

Comments
 (0)