40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Modules\EcommerceFinance\Providers;
|
|
|
|
use Illuminate\Support\ServiceProvider as Provider;
|
|
use Modules\EcommerceFinance\Services\JianSunSnapshotRefresher;
|
|
use Modules\EcommerceFinance\Services\OperationsReplicaSnapshotRefresher;
|
|
use Modules\EcommerceFinance\Services\UpstreamSnapshotRefresherRegistry;
|
|
use Modules\EcommerceFinance\Services\UpstreamSourceRegistry;
|
|
|
|
class Main extends Provider
|
|
{
|
|
public function boot(): void
|
|
{
|
|
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'ecommerce-finance');
|
|
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
|
|
}
|
|
|
|
public function register(): void
|
|
{
|
|
$this->app->singleton(UpstreamSnapshotRefresherRegistry::class, function ($app) {
|
|
$registry = new UpstreamSnapshotRefresherRegistry(
|
|
$app->make(UpstreamSourceRegistry::class)
|
|
);
|
|
$registry->register('jiansun', fn () => $app->make(JianSunSnapshotRefresher::class));
|
|
$registry->register('operations_replica', fn () => $app->make(OperationsReplicaSnapshotRefresher::class));
|
|
|
|
return $registry;
|
|
});
|
|
|
|
if (app()->routesAreCached()) {
|
|
return;
|
|
}
|
|
|
|
foreach (['admin.php', 'api.php'] as $route) {
|
|
$this->loadRoutesFrom(__DIR__ . '/../Routes/' . $route);
|
|
}
|
|
}
|
|
}
|