registerApplier(...). */ class ContentTemplatesServiceProvider extends ServiceProvider { public function register(): void { $this->app->singleton(ContentTemplateRegistry::class); $this->app->singleton(CanvasItemsApplier::class); $this->app->singleton(WikiApplier::class); } public function boot(): void { /** @var ContentTemplateRegistry $registry */ $registry = $this->app->make(ContentTemplateRegistry::class); // WikiApplier is registered first so it claims "wiki" before the // catch-all CanvasItemsApplier. The registry uses one applier per // appliesTo, so order matters here only because supports() on the // canvas applier excludes 'wiki' explicitly — kept defensive. $registry->registerApplier('wiki', $this->app->make(WikiApplier::class)); // CanvasItemsApplier is the catch-all for any non-wiki appliesTo. We // can't enumerate every canvas type at boot (plugins add their own), // so the registry consults supports() at apply time when a template's // appliesTo isn't explicitly bound. $canvasApplier = $this->app->make(CanvasItemsApplier::class); foreach (['logicmodel', 'goal', 'leancanvas', 'swot'] as $canvasType) { $registry->registerApplier($canvasType, $canvasApplier); } } }