singleton( ContentRepository::class, fn (Container $c) => new DatabaseContentRepository( $c->get(ConnectionInterface::class) ) ); $container->singleton( ContentTypeRepository::class, fn (Container $c) => new DatabaseContentTypeRepository( $c->get(ConnectionInterface::class) ) ); // Block Type Registry $container->singleton( BlockTypeRegistry::class, fn () => new BlockTypeRegistry() ); // Services $container->singleton( BlockValidator::class, fn (Container $c) => new BlockValidator( $c->get(BlockTypeRegistry::class) ) ); $container->singleton( SlugGenerator::class, fn (Container $c) => new SlugGenerator( $c->get(ContentRepository::class) ) ); $container->singleton( ContentService::class, fn (Container $c) => new ContentService( $c->get(ContentRepository::class), $c->get(BlockValidator::class), $c->get(SlugGenerator::class), $c->get(Clock::class) ) ); $container->singleton( ContentTypeService::class, fn (Container $c) => new ContentTypeService( $c->get(ContentTypeRepository::class), $c->get(ContentRepository::class), $c->get(Clock::class) ) ); // Content Translation Repository $container->singleton( ContentTranslationRepository::class, fn (Container $c) => new DatabaseContentTranslationRepository( $c->get(ConnectionInterface::class) ) ); // Content Localization Service $container->singleton( ContentLocalizationService::class, fn (Container $c) => new ContentLocalizationService( $c->get(ContentTranslationRepository::class), $c->get(Clock::class) ) ); // Block Renderer Registry $container->singleton( BlockRendererRegistry::class, function (Container $c) { $registry = new BlockRendererRegistry(); // Register default renderers $registry->registerForType('hero', new HeroBlockRenderer()); $registry->registerForType('text', new TextBlockRenderer()); $registry->registerForType('image', new ImageBlockRenderer()); return $registry; } ); // Content Renderer $container->singleton( ContentRenderer::class, fn (Container $c) => new ContentRenderer( $c->get(BlockRendererRegistry::class), $c->get(ComponentRenderer::class), $c->get(ContentLocalizationService::class), new DefaultBlockRenderer() ) ); } }