getUser($request); if (!Authority::canUpdateClipboard($user, $clipboard)) { throw new AuthorizationFailedException(); } $json = $this->validate($request, $args); $clipboard->name = $json['data']['attributes']['name']; $clipboard->store(); return $this->getContentResponse($clipboard); } protected function validateResourceDocument($json, $data) { if (!self::arrayHas($json, 'data.attributes.name')) { return 'No name for the clipboard defined'; } if (!trim(self::arrayGet($json, 'data.attributes.name'))) { return 'Name of the clipboard may not be empty'; } return null; } }