/** * Execute the job. * * @return bool */ public function handle() { $this->workRequest->subject = $this->request->input('subject', $this->workRequest->subject); $this->workRequest->best_time = $this->request->input('best_time', $this->workRequest->best_time); $this->workRequest->description = $this->request->clean($this->request->input('description', $this->workRequest->description)); return $this->workRequest->save(); }
/** * Execute the job. * * @return bool */ public function handle() { $this->workRequest->user_id = auth()->id(); $this->workRequest->subject = $this->request->input('subject'); $this->workRequest->best_time = $this->request->input('best_time'); $this->workRequest->description = $this->request->clean($this->request->input('description')); return $this->workRequest->save(); }
/** * Execute the job. * * @return bool */ public function handle() { // We'll make sure the work request doesn't already have a // work order attached to it before we try and create it. if (!$this->workRequest->hasWorkOrder()) { $priority = Priority::findOrCreateRequested(); $status = Status::findOrCreateRequested(); $workOrder = new WorkOrder(); $workOrder->status_id = $status->getKey(); $workOrder->priority_id = $priority->getKey(); $workOrder->request_id = $this->workRequest->getKey(); $workOrder->user_id = $this->workRequest->user_id; $workOrder->subject = $this->workRequest->subject; $workOrder->description = $this->workRequest->description; if ($workOrder->save()) { return $workOrder; } } return false; }
/** * Returns a new form for the specified work request. * * @param WorkRequest $request * * @return \Orchestra\Contracts\Html\Builder */ public function form(WorkRequest $request) { return $this->form->of('work-requests', function (FormGrid $form) use($request) { if ($request->exists) { $method = 'PATCH'; $url = route('maintenance.work-requests.update', [$request->getKey()]); $form->submit = 'Save'; } else { $method = 'POST'; $url = route('maintenance.work-requests.store'); $form->submit = 'Create'; } $form->with($request); $form->attributes(compact('method', 'url')); $form->fieldset(function (Fieldset $fieldset) { $fieldset->control('input:text', 'subject')->attributes(['placeholder' => 'Enter Subject']); $fieldset->control('input:text', 'best_time')->attributes(['placeholder' => 'Enter Best Time']); $fieldset->control('input:textarea', 'description'); }); }); }
/** * Deletes the specified work request. * * @param int|string $id * * @return bool */ public function destroy($id) { $workRequest = $this->workRequest->findOrFail($id); return $workRequest->delete(); }