public function update($id, Request $request) { $asset = Asset::findOrFail($id); $types = array_keys($this->asset_type); $sections = array_keys($this->sections); $request['type'] = $types[$request['type']]; $request['section'] = $sections[$request['section']]; $request['asset_id'] = $this->getAssetId($request); $asset->update($request->all()); return redirect('assets'); }
/** * Update the specified resource in storage. * * @param AssetRequest $request * @param int $id * @return Response */ public function update(AssetRequest $request, $id) { $asset = Asset::findOrFail($id); $asset->update($request->all()); $asset->saveImage($request); flash()->success('Success!', 'Asset updated successfully!'); return redirect('assets'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $asset = Asset::findOrFail($id); $asset->delete(); return redirect()->route('assets.index')->with('message', 'Item deleted successfully.'); }