From a1a50aaddb674b2a0971ecb697d17858d40ca666 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Mon, 14 Oct 2024 00:07:39 +0200 Subject: [PATCH] Add Component Resolver for Modules --- app/Providers/BaseServiceProvider.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Providers/BaseServiceProvider.php b/app/Providers/BaseServiceProvider.php index ce9ec2c7..65d77dd9 100644 --- a/app/Providers/BaseServiceProvider.php +++ b/app/Providers/BaseServiceProvider.php @@ -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; + }); } /**