| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace App\Module\OAuth;
- use Illuminate\Support\ServiceProvider;
- use Illuminate\Support\Facades\View;
- use Illuminate\Support\ViewErrorBag;
- use App\Module\OAuth\Middleware\StartSession;
- class OAuthServiceProvider extends ServiceProvider
- {
- /**
- * 注册服务
- */
- public function register()
- {
- // 注册中间件
- $this->app['router']->aliasMiddleware('oauth.session', StartSession::class);
- }
- /**
- * 引导服务
- */
- public function boot()
- {
- // 注册视图命名空间
- $this->loadViewsFrom(__DIR__ . '/resources/views', 'oauth');
- // 加载路由
- $this->loadRoutesFrom(__DIR__ . '/routes.php');
- // 发布资源文件
- $this->publishes([
- __DIR__ . '/resources/assets' => public_path('modules/oauth'),
- ], 'oauth-assets');
- // 共享视图变量
- View::share('errors', new ViewErrorBag);
- }
- }
|