ultimatepos/Modules/ShopFloor/Providers/ShopFloorServiceProvider.php

47 lines
1.3 KiB
PHP

<?php
namespace Modules\ShopFloor\Providers;
use Illuminate\Support\ServiceProvider;
class ShopFloorServiceProvider extends ServiceProvider
{
protected $moduleName = 'ShopFloor';
protected $moduleNameLower = 'shopfloor';
public function boot(): void
{
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations'));
}
public function register(): void
{
$this->app->register(RouteServiceProvider::class);
$this->app->singleton(\Modules\ShopFloor\Services\OeeCalculationService::class);
$this->app->singleton(\Modules\ShopFloor\Services\ProductionEventService::class);
}
protected function registerConfig(): void
{
$this->mergeConfigFrom(
module_path($this->moduleName, 'Config/config.php'),
$this->moduleNameLower
);
}
public function registerViews(): void
{
$sourcePath = module_path($this->moduleName, 'Resources/views');
$this->loadViewsFrom([$sourcePath], $this->moduleNameLower);
}
public function registerTranslations(): void
{
$this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower);
}
}