/** * Displays the specified work orders parts and inventory. * * @param int|string $workOrderId * * @return \Illuminate\View\View */ public function index($workOrderId) { $workOrder = $this->workOrder->findOrFail($workOrderId); $parts = $this->presenter->table($workOrder); $inventory = $this->presenter->tableInventory($workOrder, $this->inventory); $navbarParts = $this->presenter->navbarParts($workOrder); $navbarInventory = $this->presenter->navbarInventory(); return view('work-orders.parts.index', compact('parts', 'inventory', 'workOrder', 'navbarParts', 'navbarInventory')); }
/** * Processes returning stock from the work order back into the specified inventory. * * @param PartReturnRequest $request * @param int|string $workOrderId * @param int|string $itemId * @param int|string $stockId * * @throws \Stevebauman\Inventory\Exceptions\InvalidQuantityException * * @return bool */ public function postPut(PartReturnRequest $request, $workOrderId, $itemId, $stockId) { $workOrder = $this->workOrder->findOrFail($workOrderId); // Even though the inventory item isn't necessary here, we'll // find it anyway so we can check for the requests validity // and ensure the specified stock is actually attached to // the one requested. $item = $this->inventory->findOrFail($itemId); $item->stocks()->findOrFail($stockId); $stock = $workOrder->parts()->findOrFail($stockId); return $this->dispatch(new Put($request, $workOrder, $stock)); }
/** * Prompts the user to download the specified uploaded file. * * @param int|string $workOrderId * @param int|string $attachmentId * * @return \Symfony\Component\HttpFoundation\BinaryFileResponse */ public function download($workOrderId, $attachmentId) { $workOrder = $this->workOrder->findOrFail($workOrderId); $attachment = $workOrder->attachments()->findOrFail($attachmentId); return response()->download($attachment->download_path); }
/** * Deletes the specified work order. * * @param int|string $id * * @return bool */ public function destroy($id) { $workOrder = $this->workOrder->findOrFail($id); return $workOrder->delete(); }
/** * Ends the current users session for the specified work order. * * @param int|string $workOrderId * * @return mixed */ public function end($workOrderId) { $workOrder = $this->workOrder->findOrFail($workOrderId); return $this->dispatch(new End($workOrder)); }
public function show($workOrderId, $reportId) { $workOrder = $this->workOrder->findOrFail($workOrderId); $report = $workOrder->report()->findOrFail($reportId); return view('work-orders.report', compact('workOrder', 'report')); }