lk.zachem.info/app/Modules/Plan7/Providers/ModuleServiceProvider.php

80 lines
2.0 KiB
PHP

<?php
namespace Modules\Plan7\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Blade;
use Livewire\Livewire;
class ModuleServiceProvider extends ServiceProvider
{
protected string $moduleName = 'Plan7';
public function register()
{
$this->app->register(RouteServiceProvider::class);
}
public function boot()
{
$this->registerViews();
$this->registerLivewireViews();
$this->registerMigrations();
$this->registerConfig();
$this->registerComponent();
$this->registerLivewire();
$this->registerHelpers();
}
protected function registerViews()
{
$moduleViewsPath = __DIR__ . '/../Views';
$this->loadViewsFrom(
$moduleViewsPath,
strtolower($this->moduleName)
);
}
protected function registerLivewireViews()
{
$moduleViewsPath = __DIR__ . '/../Views/livewire';
$this->loadViewsFrom(
$moduleViewsPath,
strtolower($this->moduleName)
);
}
protected function registerMigrations()
{
$this->loadMigrationsFrom(
app_path('Modules/' . $this->moduleName . '/Database/Migrations')
);
}
protected function registerConfig()
{
$path = app_path('Modules/' . $this->moduleName . '/Config/config.php');
$this->mergeConfigFrom(
$path,
strtolower($this->moduleName)
);
}
protected function registerLivewire()
{
Livewire::component('plan7Selector', \Modules\Plan7\Http\Livewire\Plan7SelectorLivewire::class);
}
protected function registerComponent()
{
//Blade::component('document', \Modules\Plan7\Http\Components\DocumentComponent::class);
}
protected function registerHelpers()
{
$files = glob(__DIR__ . '/../Helpers/' . "*.php");
foreach ($files as $key => $file) {
require_once $file;
}
}
}