authorizeOrFail('manage_options'); return $this->ok($this->preferences->forSettings($this->templates())) ->header('Cache-Control', 'no-store, private'); } public function update(Request $request): JsonResponse { $this->authorizeOrFail('manage_options'); $errors = $this->preferences->save($request->all(), $this->templates()); if ($errors !== []) { return $this->validationError($errors); } return $this->ok($this->preferences->forSettings($this->templates())) ->header('Cache-Control', 'no-store, private'); } /** * Content Studio templates currently available to this site. * * @return array, source: string}> */ private function templates(): array { $templates = []; foreach ($this->extensions->definitions()->all('template') as $item) { if (($item['data']['studio'] ?? '') === StudioRunController::STUDIO) { $templates[(string) $item['data']['id']] = $item; } } return $templates; } }