app->singleton(ReplenishmentRun::class); $this->app->singleton(RequisitionExpiryRun::class); $this->app->scoped(AdministrativeGeography::class); $this->app->scoped(StandaloneRuntime::class, fn () => new StandaloneRuntime(config('standalone-runtime'), new StandaloneArtifact)); $runtime = $this->app->make(StandaloneRuntime::class); $loader = $runtime; $paths = null; $preparing = config('standalone-runtime.prepare_only') === true; if ($preparing && (! $this->app->runningInConsole() || $runtime->enabled())) { throw new \LogicException('COMPRAS_RUNTIME_PREPARATION_CONSOLE_ONLY'); } if ($runtime->enabled() || $preparing) { if (config('common-finance-bundle.root') !== null || config('budget-distributions.enabled') === true) { throw new \LogicException('COMPRAS_RUNTIME_MIXED_COMPOSITION'); } if ($preparing) { $settings = config('standalone-runtime'); $settings['enabled'] = true; $loader = new StandaloneRuntime($settings, new StandaloneArtifact); $paths = $loader->artifact()['paths']; } else { $paths = $runtime->configure(DB::connection()); } $loader->assertLoadedPackages(allowMissing: true); config(['common-budget.path' => $paths['budget-control'], 'common-payables.path' => $paths['payables'], 'general-ledger.path' => $paths['general-ledger']]); } require_once ($paths['purchasing'] ?? config('common-purchasing.path')).'/bootstrap.php'; $package = config('common-budget.path'); if (config('budget-distributions.enabled') === true) { BudgetDistributionArtifact::verify($package, config('budget-distributions.artifact_manifest'), config('budget-distributions.artifact_manifest_sha256')); } require_once $package.'/bootstrap.php'; FinanceBundle::configure(); $payables = config('common-payables.path'); require_once $payables.'/bootstrap.php'; if ($paths !== null) { require_once $paths['general-ledger'].'/bootstrap.php'; $loader->assertLoadedPackages(); } } /** * Bootstrap any application services. */ public function boot(): void { $this->configureDefaults(); } /** * Configure default behaviors for production-ready applications. */ protected function configureDefaults(): void { Date::use(CarbonImmutable::class); DB::prohibitDestructiveCommands( app()->isProduction(), ); Password::defaults(fn (): ?Password => app()->isProduction() ? Password::min(12) ->mixedCase() ->letters() ->numbers() ->symbols() ->uncompromised() : null, ); } }