/**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $spares = Spares::find($id);
     $spares->delete();
     // redirect
     Session::flash('message', 'Successfully deleted the spares!');
     return Redirect::to('spares');
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $supply = Supply::find($id);
     $spares = Spares::lists('spar', 'id');
     $spares_selected = $supply->spares->id;
     $data = array('supply' => $supply, 'spares' => $spares, 'spares_selected' => $spares_selected);
     // show the edit form and pass the supply
     return View::make('supply.edit')->with($data);
 }
 public function sparedetail($id)
 {
     if ($id) {
         $spares = Spares::find($id);
         // show the view and pass the spares to it
         return View::make('spares.sparedetail')->with('spares', $spares);
     }
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $spares = Spares::lists('spar', 'id');
     return View::make('order.create')->with('spares', $spares);
 }