app->singleton(ChannelService::class, function () { return ChannelService::fromConfig(); }); $this->app->bind(ImageManager::class, function () { return new ImageManager(["driver" => "imagick"]); }); $this->app->bind(DatabaseGraph::class, function () { return new PgsqlDatabaseGraph(); }); $this->app->bind(UserRepo::class, function ($app) { return match ($app->make(ChannelService::class)->channel->auth) { ChannelAuth::LUNAR => new UserRepoLunar(), ChannelAuth::LUCENT => new UserRepoLucent(), }; }); $this->app->bind(AuthService::class, function ($app) { return match ($app->make(ChannelService::class)->channel->auth) { ChannelAuth::LUNAR => $app->make(AuthServiceLunar::class), ChannelAuth::LUCENT => $app->make(AuthServiceLucent::class), }; }); } /** * Bootstrap any package services. */ public function boot(Router $router): void { $manifestPath = public_path("vendor/lucent/dist/manifest.json"); $manifest = null; if (file_exists($manifestPath)) { $manifest = json_decode( file_get_contents( public_path("vendor/lucent/dist/manifest.json"), ), true, ); } $router->aliasMiddleware( "lucent.auth", \Lucent\Http\Middleware\AuthMiddleware::class, ); $router->aliasMiddleware( "lucent.guest", \Lucent\Http\Middleware\GuestMiddleware::class, ); $this->loadViewsFrom(__DIR__ . "/../front/views", "lucent"); $this->loadRoutesFrom(__DIR__ . "/Http/web.php"); $this->loadRoutesFrom(__DIR__ . "/Http/api.php"); if ($this->app->runningInConsole()) { $this->commands([ CompileSchemas::class, RebuildThumbnails::class, LiveLink::class, RemoveOrphanEdges::class, SetupDatabase::class, GenerateCollectionSchema::class, Export::class, Import::class, Setup::class, ]); } View::share("manifest", $manifest); View::share("file", app()->make(FileService::class)); Blade::anonymousComponentPath( __DIR__ . "../front/views/components", "lucent", ); $this->publishes( [ __DIR__ . "/Config/main.php" => config_path("lucent.php"), ], "lucent-config", ); $this->publishes( [ __DIR__ . "/../front/dist" => public_path("vendor/lucent/dist"), __DIR__ . "/../front/public" => public_path( "vendor/lucent/public", ), ], "lucent", ); } }