/** * Removes the specified work order from the specified asset. * * @param int|string $assetId * @param int|string $workOrderId * * @return \Illuminate\Http\RedirectResponse */ public function remove($assetId, $workOrderId) { if ($this->asset->detachWorkOrder($assetId, $workOrderId)) { $message = 'Successfully detached work order.'; return redirect()->route('maintenance.assets.work-orders.index', [$assetId])->withSuccess($message); } else { $message = 'There was an issue detaching this work order. Please try again.'; return redirect()->route('maintenance.assets.work-orders.index', [$assetId])->withErrors($message); } }
/** * Prompts the user to download the specified uploaded file. * * @param int|string $id * @param int|string $imageId * * @return \Symfony\Component\HttpFoundation\BinaryFileResponse */ public function download($id, $imageId) { $asset = $this->asset->find($id); $image = $asset->images()->find($imageId); if ($image) { return response()->download($image->download_path); } abort(404); }
/** * Prompts the user to download the specified uploaded file. * * @param int|string $id * @param int|string $manualId * * @return \Symfony\Component\HttpFoundation\BinaryFileResponse */ public function download($id, $manualId) { $asset = $this->asset->find($id); $manual = $asset->manuals()->find($manualId); if ($manual) { return response()->download($manual->download_path); } abort(404); }
/** * Deletes the specified meter for the specified asset. * * @param int|string $id * @param int|string $meterId * * @return \Illuminate\Http\RedirectResponse */ public function destroy($id, $meterId) { $asset = $this->asset->model()->findOrFail($id); $meter = $asset->meters()->findOrFail($meterId); if ($meter->delete()) { $message = 'Successfully deleted meter.'; return redirect()->route('maintenance.assets.meters.index', [$id])->withSuccess($message); } else { $message = 'There was an issue deleting this meter. Please try again.'; return redirect()->route('maintenance.assets.meters.show', [$id, $meterId])->withErrors($message); } }