/**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $product = Product::find($id);
     $providers = Provider::all();
     $productTypes = ProductType::all();
     return view('product.edit', compact('product', 'productTypes', 'providers'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $provider = Provider::find($id);
     $products = DB::table('products')->select('id')->where('provider_id', '=', $provider->id)->get();
     foreach ($products as $product) {
         Product::destroy($product->id);
     }
     Provider::destroy($id);
     Session::flash('message', 'Proveedor eliminado correctamente');
     return Redirect::to('/provider');
 }