public function getViewCategories(Request $request, $id)
 {
     $subPaginate = '';
     if ($request->input('model') == '') {
         $products = DB::table('products')->where('category', $id)->orderBy('id', 'desc')->paginate(12);
     } else {
         $products = DB::table('products')->where('category', $id)->where('model', $request->input('model'))->orderBy('id', 'desc')->paginate(12);
         $subPaginate = 'on';
         $products->setPath('?model=' . $request->input('model'));
     }
     $count = 0;
     // making clearfix for latest products
     $categories = ProductCategories::findOrFail($id);
     $productImages = DB::table('product_images')->get();
     $subCategories = DB::table('product_sub_categories')->where('in_category', $id)->orderBy('position', 'asc')->get();
     $brands = DB::table('brands')->orderBy('position', 'asc')->get();
     $selectedBrand = $request->input('brand_id');
     $selectedModel = $request->input('model');
     $models = DB::table('models')->where('in_brand', $request->input('brand'))->get();
     return view('pages.view-category')->with('products', $products)->with('categories', $categories)->with('count', $count)->with('subPaginate', $subPaginate)->with('productImages', $productImages)->with('subCategories', $subCategories)->with('brands', $brands)->with('selectedBrand', $selectedBrand)->with('selectedModel', $selectedModel)->with('models', $models);
 }