run(fn () => $service->get()); } public function save(SiteConfigurationService $service) { return $this->run(fn () => $service->save(request()->all())); } private function run(callable $callback) { try { return $this->success($callback())->header('Cache-Control', 'no-store'); } catch (ValidationException $e) { return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first()); } catch (\Throwable $e) { Log::error('site_configuration_admin_failed', ['exception' => $e]); return $this->error(HttpStatus::CUSTOM_ERROR, '站点配置暂不可用,请稍后重试'); } } }