34 lines
601 B
PHP
34 lines
601 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
use App\Console\Commands\EnvCommand;
|
|
|
|
class EnvServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* 注册服务
|
|
*/
|
|
public function register(): void
|
|
{
|
|
// 注册环境管理服务
|
|
$this->app->singleton(\App\Services\EnvService::class);
|
|
}
|
|
|
|
/**
|
|
* 启动服务
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
// 注册Artisan命令
|
|
if ($this->app->runningInConsole()) {
|
|
$this->commands([
|
|
EnvCommand::class,
|
|
]);
|
|
}
|
|
|
|
|
|
}
|
|
}
|