/**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $data = ProductModel::findOrfail($id);
     $data->delete($id);
     return redirect()->route('product_view')->with('message', 'product data delete successfully.....');
 }
 public function product_status($id)
 {
     DB::transaction(function ($id) use($id) {
         //upto this code for Sub category status inactive .....
         $Pro = ProductModel::where('subcategory_id', $id)->get();
         foreach ($Pro as $p) {
             if ($p->status == 1) {
                 $datam = ProductModel::findOrfail($p->id);
                 $datam->update(['status' => 0]);
             }
         }
         // upto this .....
     });
 }
 public function showCart()
 {
     $products = ProductModel::getProductById($productId);
     //dd($products);
     $categoryAndSubcategory = CategoryModel::getCategory();
     //dd($categoryAndSubcategory);
     //dd($products);
     $cartProducts = Cart::getContent();
     return view('user.pages.product_cart')->with('categoryAndSubcategory', $categoryAndSubcategory)->with('products', $products)->with('cartProducts', $cartProducts);
 }
 /**
  * send a all product by its subcategory.
  * 
  * @return type collection
  */
 public static function getProductBySubCategoryId($subCategoryId)
 {
     $products = ProductModel::where('subcategory_id', '=', $subCategoryId)->get();
     return $products;
 }