Preserva base local aceite de identidade e acessos

This commit is contained in:
Codex
2026-10-25 21:29:22 +02:00
commit 26b80df545
112 changed files with 13259 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use App\Shared\Context\CompanyContext;
use App\Shared\Testing\TestingDatabaseGuard;
use Illuminate\Console\Events\CommandStarting;
use Illuminate\Support\Facades\Event;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
$this->app->scoped(CompanyContext::class, fn () => new CompanyContext());
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
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)) {
$connection = $event->input->hasOption('database') ? $event->input->getOption('database') : null;
TestingDatabaseGuard::assertSafe($connection);
}
});
}
}