> */ private array $blocks = []; /** * @return array */ public function load(): array { return collect($this->blocks)->map(fn ($block) => app($block))->toArray(); } /** * @param class-string $block */ public function register(string $block): self { $this->blocks[] = $block; $componentName = str($block)->replace('\\', '.')->explode('.')->map(fn ($part) => str($part)->lcfirst()->kebab())->implode('.'); Livewire::component($componentName, $block); return $this; } public function purge(): self { $this->blocks = []; return $this; } }