attributes($input); $columns = CreateApiKey::permissions($permissions); if ($key->key_type === ApiKey::TYPE_APPLICATION) { $attributes = [...$attributes, ...$columns]; } $key->forceFill($attributes)->saveOrFail(); return $key; } /** * Validates update input and returns the attributes it changes: the memo, when it is * given. A key's owner and allowed IPs are set when it is created. * * @param ActionInput $input * @return array{memo?: string} */ private function attributes(array $input): array { $input = Validator::make($input, ['memo' => ['sometimes', ...CreateApiKey::rules()['memo']]])->safe(); return $input->has('memo') ? ['memo' => $input->string('memo')->toString()] : []; } }