openstamanager/src/ServiceProvider.php

61 lines
1.3 KiB
PHP

<?php
use Illuminate\Support\ServiceProvider as BaseProvider;
class ServiceProvider extends BaseProvider
{
/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot(): void
{
$this->loadRoutesFrom(__DIR__.'/../routes.php');
// Publishing is only necessary when using the CLI.
if ($this->app->runningInConsole()) {
$this->bootForConsole();
}
}
/**
* Register any package services.
*
* @return void
*/
public function register(): void
{
// Register the service the package provides.
$this->app->singleton('legacy', function ($app) {
return new \AppLegacy();
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return ['legacy'];
}
/**
* Console-specific booting.
*
* @return void
*/
protected function bootForConsole(): void
{
// Publishing assets.
$this->publishes([
__DIR__.'/../assets' => public_path('vendor/devcode-it'),
], 'causali-trasporto');
// Registering package commands.
// $this->commands([]);
}
}