public function makeWineMenu($menu) { $menu = $this->menu->findBy('name', str_replace('-', ' ', $menu)); $subcategoryRepo = new ParseSubCategoryRepository(); $subcategories = $subcategoryRepo->findAllBy('menu', $menu, ['category'], 1000, true, 'position'); $categories = $this->categories->findAllBy('menu', $menu, [], 1000, true, 'position'); $items = $this->items->findAllBy('menu', $menu, ['category'], 1000, true, 'position'); return ['subcategories' => $subcategories, 'categories' => $categories, 'items' => $items, 'menu' => $menu]; }
public function compose(View $view) { $menu = $this->menu->findBy('name', str_replace('-', ' ', $this->request->route('menu_name'))); $categories = $this->categories->findAllBy('menu', $menu, [], 1000, true, 'position'); // dd([$menu, $categories, strcmp($this->request->route('menu_name'), 'wine-list')==0]); if (strcmp($this->request->route('menu_name'), 'wine-list') == 0) { $subcategoryRepo = new ParseSubCategoryRepository(); $subcategories = $subcategoryRepo->findAllBy('menu', $menu, ['category'], 1000, true, 'position'); $items = $this->items->findAllBy('menu', $menu, ['category'], 1000, true, 'position'); $view->with(['subcategories' => $subcategories, 'categories' => $categories, 'items' => $items, 'archives' => $this->archives->all(), 'menu' => $menu]); } else { // $items = $this->items->all(['category'], 1000, true, 'position'); $items = $this->items->findAllBy('menu', $menu, ['category'], 1000, true, 'position'); $view->with(['categories' => $categories, 'items' => $items, 'archives' => $this->archives->all(), 'menu' => $menu]); } }