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 .....
     });
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $data = ProductModel::where('id', $id)->get();
     $cat = CategoryModel::where('status', 1)->get();
     $subcat = SubCategoryModel::where('status', 1)->get();
     // dd($data);
     return view('admin.pages.product.product_edit')->with('data', $data)->with('cat', $cat)->with('subcat', $subcat);
 }
 /**
  * send a all product by its subcategory.
  * 
  * @return type collection
  */
 public static function getProductBySubCategoryId($subCategoryId)
 {
     $products = ProductModel::where('subcategory_id', '=', $subCategoryId)->get();
     return $products;
 }