在哪里注册立面&流明的服务提供商 [英] Where to register Facades & Service Providers in Lumen
本文介绍了在哪里注册立面&流明的服务提供商的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找在流明下面添加外观的位置.
I Am looking for where to add the facade below in Lumen.
'JWTAuth' => 'Tymon\JWTAuth\Facades\JWTAuth'
已编辑
也在bootstrap\app.php
$app->register('Tymon\JWTAuth\Providers\JWTAuthServiceProvider');
请协助.
推荐答案
在您的bootstrap/app.php
中,确保您未评论:
In your bootstrap/app.php
, make sure you've un-commented:
$app->withFacades();
然后,注册您的类别名并检查它是否已经存在(否则您的测试将失败):
Then, register you class alias and check if it already exists (else your tests will break):
if (!class_exists('JWTAuth')) {
class_alias('Tymon\JWTAuth\Facades\JWTAuth', 'JWTAuth');
}
要注册您的ServiceProvider
,请检查您的bootstrap/app.php
:
To register your ServiceProvider
, check your bootstrap/app.php
:
/*
|--------------------------------------------------------------------------
| Register Service Providers
|--------------------------------------------------------------------------
|
| Here we will register all of the application's service providers which
| are used to bind services into the container. Service providers are
| totally optional, so you are not required to uncomment this line.
|
*/
// $app->register('App\Providers\AppServiceProvider');
// Add your service provider here
$app->register('Tymon\JWTAuth\Providers\JWTAuthServiceProvider');
更新#1
我在此处制作了一个简单的样板,以将流明与JWT和Dingo集成.
Update #1
I made a simpel boilerplate here to integrate Lumen with JWT and Dingo.
这篇关于在哪里注册立面&流明的服务提供商的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文