Add Component Resolver for Modules

This commit is contained in:
philipp lang 2024-10-14 00:07:39 +02:00
parent 1e5e13f85e
commit 2c7a243da3
1 changed files with 10 additions and 0 deletions

View File

@ -35,6 +35,16 @@ class BaseServiceProvider extends ServiceProvider
$self = $this;
return $condition ? $self->merge([$key => $attributes]) : $self;
});
Livewire::resolveMissingComponent(function ($name) {
'modules.dashboard.components.dashboard-component';
if (str($name)->startsWith('modules.')) {
return str($name)->explode('.')->map(fn ($name) => str($name)->studly()->toString())->implode('\\');
}
return null;
});
}
/**