public function getAddProduct(Request $request) { if (Auth::user()->email == '*****@*****.**') { $productCategories = ProductCategories::all(); $subProductCategories = SubProductCategories::all(); $brands = Brands::all(); $models = Models::all(); return view('admin.add-product')->with('productCategories', $productCategories)->with('subProductCategories', $subProductCategories)->with('brands', $brands)->with('models', $models); } return redirect('/'); }
public function getViewModels(Request $request, $id) { if ($request->input('subcategory-id') == '') { $products = DB::table('products')->where('model', $id)->orderBy('id', 'desc')->paginate(18); } else { $products = DB::table('products')->where('model', $id)->where('sub_category', $request->input('subcategory-id'))->orderBy('id', 'desc')->paginate(500); } $categories = ProductCategories::all(); $subcategories = SubProductCategories::all(); $currentPath = $request->url(); $models = Models::findOrFail($id); $productImages = DB::table('product_images')->get(); $count = 0; // making clearfix for latest products return view('pages.view-model')->with('products', $products)->with('categories', $categories)->with('subcategories', $subcategories)->with('currentPath', $currentPath)->with('models', $models)->with('productImages', $productImages)->with('count', $count); }