app->scoped(CompanyContext::class, fn () => new CompanyContext()); } /** * Bootstrap any application services. */ public function boot(): void { if ($routes = \App\Modules\Purchasing\InternalRequisitionQa::mount()) { $this->loadRoutesFrom($routes); } if ($this->app->environment(['testing', 'browser-testing']) || defined('PHPUNIT_COMPOSER_INSTALL')) { TestingDatabaseGuard::assertSafe(); } Event::listen(CommandStarting::class, function (CommandStarting $event): void { if (in_array($event->command, ['migrate:fresh', 'migrate:refresh', 'migrate:reset', 'migrate:rollback', 'db:wipe'], true)) { if($this->app->environment('budget-testing'))throw new \RuntimeException('SGF_COMPOSITION_DESTRUCTIVE_COMMAND_REFUSED'); $connection = $event->input->hasOption('database') ? $event->input->getOption('database') : null; TestingDatabaseGuard::assertSafe($connection); } }); } }