2024-09-23 23:49:17 +02:00
|
|
|
<?php
|
|
|
|
|
2024-10-13 21:00:47 +02:00
|
|
|
namespace App\Providers;
|
2024-09-23 23:49:17 +02:00
|
|
|
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
use Illuminate\Support\Facades\Blade;
|
|
|
|
use Illuminate\View\ComponentAttributeBag;
|
|
|
|
use Livewire\Livewire;
|
|
|
|
|
2024-09-24 01:26:08 +02:00
|
|
|
class BaseServiceProvider extends ServiceProvider
|
2024-09-23 23:49:17 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Register services.
|
|
|
|
*/
|
|
|
|
public function register(): void
|
|
|
|
{
|
2024-10-13 21:00:47 +02:00
|
|
|
Blade::componentNamespace('App\\View\\Ui', 'ui');
|
|
|
|
Blade::componentNamespace('App\\View\\Page', 'page');
|
2024-10-14 20:25:11 +02:00
|
|
|
Blade::componentNamespace('App\\View\\Form', 'form');
|
2024-09-23 23:49:17 +02:00
|
|
|
|
|
|
|
ComponentAttributeBag::macro('mergeWhen', function ($condition, $key, $attributes) {
|
|
|
|
/** @var ComponentAttributeBag */
|
|
|
|
$self = $this;
|
|
|
|
return $condition ? $self->merge([$key => $attributes]) : $self;
|
|
|
|
});
|
2024-10-14 00:07:39 +02:00
|
|
|
|
|
|
|
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;
|
|
|
|
});
|
2024-09-23 23:49:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Bootstrap services.
|
|
|
|
*/
|
|
|
|
public function boot(): void
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|