64 lines
1.6 KiB
PHP
64 lines
1.6 KiB
PHP
<?php
|
|
namespace App\Domains\Welcome\Providers;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
use App\Domains\Welcome\Providers\MiddlewareProvider;
|
|
use App\Domains\Welcome\Providers\RouteServiceProvider;
|
|
use Illuminate\Database\Eloquent\Factory as EloquentFactory;
|
|
|
|
class WelcomeServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* 显示是否延迟提供程序的加载
|
|
*
|
|
* @var bool
|
|
*/
|
|
protected $defer = true;
|
|
|
|
/**
|
|
* 引导启动任何应用程序服务
|
|
* php artisan make:migration --path=app/Domains/Welcome/Database/migrations
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
$this->loadMigrationsFrom([realpath(__DIR__ . '/../Database/migrations')]);
|
|
$this->mergeConfigFrom(realpath(__DIR__ . '/../config.php'), 'domain.welcome');
|
|
$this->app->make(EloquentFactory::class)->load(realpath(__DIR__ . '/../Database/factories'));
|
|
}
|
|
|
|
/**
|
|
* 注册一个服务提供者
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
$this->app->register(RouteServiceProvider::class);
|
|
$this->app->register(MiddlewareServiceProvider::class);
|
|
$this->registerResources();
|
|
}
|
|
|
|
/**
|
|
* 注册服务提供者资源
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function registerResources()
|
|
{
|
|
$this->app['translator']->addNamespace('welcome', realpath(__DIR__.'/../Resources/lang'));
|
|
$this->app['view']->addNamespace('welcome', realpath(__DIR__.'/../Resources/views'));
|
|
}
|
|
|
|
/**
|
|
* 获取提供者提供的服务
|
|
*
|
|
* @return array
|
|
*/
|
|
public function provides()
|
|
{
|
|
return [];
|
|
}
|
|
}
|