Esempio n. 1
0
 /**
  * Update the specified stock in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $stock = Stock::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Stock::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $stock->update($data);
     return Redirect::route('stocks.index');
 }
Esempio n. 2
0
 /**
  * Update the specified stock in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $stock = Stock::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Stock::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $stock->item = Input::get('item');
     $stock->selling_price = Input::get('selling_price');
     $stock->purchase_price = Input::get('purchase_price');
     $stock->quantity = Input::get('quantity');
     $stock->status = Input::get('status');
     $stock->account = Input::get('account');
     $stock->update();
     return Redirect::route('purchases.index');
 }
Esempio n. 3
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $stock = $this->stock->findOrFail($id);
     return View::make('stocks.show', compact('stock'));
 }
 public function deleteAction()
 {
     $stockObjnew = new Stock();
     $new = Input::all();
     if ($stockObjnew->validate(Input::get($this->key), $new, 3)) {
         $object = Stock::findOrFail(Input::get($this->key));
         $object->delete();
     }
     return Redirect::route($this->routeIndex);
 }