public function deleteSubCategories(Request $request)
 {
     if (Auth::user()->email == '*****@*****.**') {
         SubProductCategories::where('id', $request->input('subcategory_id'))->delete();
         return redirect()->back()->with($request->session()->flash('admin-success', 'Подкатегорията беше успешно изтрита.'));
     }
 }
 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);
 }