settings = $settings; $this->settingsUpdateService = $settingsUpdateService; } /** * Генерирует новый API-ключ для URL cron-job.org и сохраняет в настройки. * * @return string новый api_key */ public function regenerate(): string { $newApiKey = bin2hex(random_bytes(32)); $all = $this->settings->getAll(); if (! isset($all['cron'])) { $all['cron'] = []; } $all['cron']['api_key'] = $newApiKey; $this->settingsUpdateService->update($all); return $newApiKey; } }