/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Category $categoryModel, Brand $brandModel, Provider $providerModel) { $categoryList = $categoryModel->getCategoriesList(); $brandList = $brandModel->getFullBrandsList(); $providerList = $providerModel->getProvedrsList(); return view('filter.index')->with('title', 'Фильтр')->with('categoryList', $categoryList)->with('brandList', $brandList)->with('providerList', $providerList); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show(Label $labelModel, History $historyModel, Purchase $purchaseModel, Provider $providerController, Brand $brandModel, Category $categoryModel, Product $productModel, $id) { $product = $productModel->getProduct($id); if (!$product) { abort(404); } $purchase = $purchaseModel->getPurchase($id); $historyProduct = $historyModel->getProductHistory($id); $historyPurchase = $historyModel->getPurchaseHistory($id); $historySite = $historyModel->getSiteHistory($id); $labels = $labelModel->getLabelsByProductsId([$id]); $arLabels = []; foreach ($labels as $label) { $arLabels[] = $label->label; } $strLabels = implode(',', $arLabels); if (!empty($product->childs)) { $product->childs = unserialize($product->childs); } $categories_list = $categoryModel->getFullCategoriesList(); $brands_list = $brandModel->getFullBrandsList(); $provider_list = $providerController->getProvedrsList(); return view('products.show')->with('title', $product->category_name . ' ' . $product->name)->with('product', $product)->with('purchase', $purchase)->with('categories_list', $categories_list)->with('brands_list', $brands_list)->with('provider_list', $provider_list)->with('history_product', $historyProduct)->with('history_purchase', $historyPurchase)->with('history_site', $historySite)->with('labels', $strLabels); }