getBody(); if ($body) { $json = $this->validate($request); } else { $json = []; } $booking = \ConsultationBooking::find($args['id']); if (!$booking) { throw new RecordNotFoundException(); } $user = $this->getUser($request); if (!Authority::canEditBooking($user, $booking)) { throw new AuthorizationFailedException(); } $reason = self::arrayGet($json, 'data.attributes.reason', ''); $booking->cancel($reason); return $this->getCodeResponse(204); } protected function validateResourceDocument($json, $data) { } }