/** * Creates a new work order customer update. * * @param string|int $workOrder_id * * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse */ public function store($workOrder_id) { if ($this->updateValidator->passes()) { $workOrder = $this->workOrder->find($workOrder_id); $update = $this->update->setInput($this->inputAll())->create(); $this->workOrder->saveUpdate($workOrder, $update); $this->message = 'Successfully added update'; $this->messageType = 'success'; $this->redirect = routeBack('maintenance.work-orders.show', [$workOrder->id]); } else { $this->errors = $this->updateValidator->getErrors(); $this->redirect = routeBack('maintenance.work-orders.show', [$workOrder_id]); } return $this->response(); }