/** * Update the status of some paperwork. * @param \App\Http\Requests\GenericRequest $request * @param \App\Event $event * @return mixed */ private function update_Paperwork(GenericRequest $request, Event $event) { // Check the event type is event if (!$event->isEvent()) { return $this->ajaxError('Paperwork is only applicable to events'); } // Check the paperwork type is valid $type = $request->get('field'); if (!isset(Event::$Paperwork[$type])) { return $this->ajaxError('Unknown paperwork type: ' . $type); } // Save $event->update(['paperwork' => array_merge($event->paperwork, [$type => $request->get('value') === 'true'])]); return Response::json(true); }