Where to register Facades & Service Providers in Lumen

后端 未结 3 982
情书的邮戳
情书的邮戳 2021-01-31 08:33

I Am looking for where to add the facade below in Lumen.

\'JWTAuth\' => \'Tymon\\JWTAuth\\Facades\\JWTAuth\'

EDITED

Also where to re

3条回答
  •  无人共我
    2021-01-31 09:24

    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');
    }
    

    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');
    

    Update #1

    I made a simpel boilerplate here to integrate Lumen with JWT and Dingo.

提交回复
热议问题