Commit 345db88b authored by Nicolas Widart's avatar Nicolas Widart

Check for the primary menu for setting the public routes

parent 481b0447
...@@ -47,18 +47,27 @@ class EloquentMenuItemRepository extends EloquentBaseRepository implements MenuI ...@@ -47,18 +47,27 @@ class EloquentMenuItemRepository extends EloquentBaseRepository implements MenuI
*/ */
public function getForRoutes() public function getForRoutes()
{ {
$menuitems = DB::table('menuitems') $menuitems = DB::table('menus')
->select('menuitems.id', 'menuitems.parent_id', 'uri', 'locale', 'module_name') ->select(
'primary',
'menuitems.id',
'menuitems.parent_id',
'menuitems.module_name',
'menuitem_translations.uri',
'menuitem_translations.locale'
)
->join('menuitems', 'menus.id', '=', 'menuitems.menu_id')
->join('menuitem_translations', 'menuitems.id', '=', 'menuitem_translations.menuitem_id') ->join('menuitem_translations', 'menuitems.id', '=', 'menuitem_translations.menuitem_id')
->where('uri', '!=', '') ->where('uri', '!=', '')
->where('module_name', '!=', '') ->where('module_name', '!=', '')
->where('status', '=', 1) ->where('status', '=', 1)
->where('primary', '=', 1)
->orderBy('module_name') ->orderBy('module_name')
->get(); ->get();
$menuitemsArray = []; $menuitemsArray = [];
foreach ($menuitems as $menuitem) { foreach ($menuitems as $menuitem) {
$menuitemsArray[$menuitem->module_name][$menuitem->locale] = $menuitem->locale . '/' .$menuitem->uri; $menuitemsArray[$menuitem->module_name][$menuitem->locale] = $menuitem->locale . '/' . $menuitem->uri;
} }
return $menuitemsArray; return $menuitemsArray;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment