Ejemplo n.º 1
0
 /**
  * Update the specified resource in storage.
  *
  * @param InventoryRequest $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(InventoryRequest $request, $id)
 {
     Inventory::find($id)->update($request->all());
     return redirect()->route('inventory.index')->withMessage('Inventory Updated Successfully')->withStatus('success');
 }
Ejemplo n.º 2
0
 /**
  * Apply the updates to our resource
  */
 public function update($id, InventoryRequest $request)
 {
     // if guest or cannot inventory.edit, redirect -> home
     if (Entrust::can('inventory.edit') == false) {
         return redirect()->route('home');
     }
     if (isset($request->btn_Cancel)) {
         return redirect()->route('inventory.show', ['id' => $id]);
     }
     $this->transaction(function ($this) use($id, $request) {
         $this->inventoryRepository->update($id, $request->all());
     });
     // when our inventory is located, redirect to show
     $totes = $this->toteRepository->filterOn(['container.child' => $id]);
     if (isset($totes) and count($totes) > 0) {
         return redirect()->route('inventory.show', ['id' => $id])->with(['status' => Lang::get('internal.updated', ['class' => Inventory::TABLE_NAME])]);
     }
     return redirect()->route('inventory.edit', ['id' => $id])->with(['status' => Lang::get('internal.updated', ['class' => Inventory::TABLE_NAME]), 'warning' => Lang::get('internal.errors.noParent') . ' ' . Lang::get('labels.titles.Move_Inventory')]);
 }