public function subcategory_status($id)
 {
     DB::transaction(function ($id) use($id) {
         //this code for Sub category status inactive .....
         $data = SubCategoryModel::where('category_id', $id)->get();
         foreach ($data as $d) {
             if ($d->status == 1) {
                 //check for product.......
                 $this->product_status($d->id);
                 //check for product inactive
                 $SubCat = SubCategoryModel::findOrfail($d->id);
                 $SubCat->update(['status' => 0]);
             }
         }
         // upto this .....
         // DB::table('users')->update(array('votes' => 1));
         // DB::table('posts')->delete();
     });
 }
 /**
  * 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);
 }
 /**
  * 
  * 
  * @return type category collection
  */
 public static function getSubCategoryByCategory($id)
 {
     return SubCategoryModel::where('category_id', '=', $id);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $data = SubCategoryModel::where('id', $id)->get();
     $category_info = CategoryModel::where('status', 1)->get();
     // dd($data);
     return view('admin.pages.subcategory.subcategory_edit')->with('data', $data)->with('category_info', $category_info);
 }