environment('testing') || ! self::isInstalled()) { return; } try { Artisan::call('config:cache'); } catch (\Throwable $e) { Log::warning('config 캐시 재생성 실패 (config:clear 로 stale 은 제거됨 — 다음 요청은 비캐시 부팅)', [ 'error' => $e->getMessage(), ]); } } /** * config 캐시만 제거합니다 (재생성 없음). * * 재생성이 부적절한 특수 경로(예: 설치 직전 초기화)를 위한 보조 진입점. * * @return void */ public static function clear(): void { Artisan::call('config:clear'); } /** * G7 설치 완료 여부를 확인합니다. * * config('app.installer_completed') 는 config:clear 직후 재로드되어 신뢰 가능하며, * 보조로 storage/app/g7_installed 플래그 파일도 확인한다. * * @return bool 설치 완료 시 true */ private static function isInstalled(): bool { if (config('app.installer_completed')) { return true; } return File::exists(storage_path('app/g7_installed')); } }