You are passing the same data to the view twice. Better to chose (and be consistent with) one or the other methodology for passing data to the view,
return view('menus::admin.create', compact('menus', 'type', 'menu_id'));
// which is equivalent to:
return view('menus::admin.create', [
'menus' => $menus,
'type' => $type,
'menu_id' => $menu_id
]);
or, using the
with
method: return view('menus::admin.create')
->with('menu_id', $menu_id)
->with( 'type', $type)
->with('menu_id', $menu_id);
There are also magic methods such as
...
->withType($type)
->withMenus($menu_id);
No comments:
Post a Comment