public function register()
    {
        // gets the auth factory instance and register on provider attribute.
        $this->authManager = $this->app->make(AuthManager::class);

        // register auth policies.
        $this->registerPolicies();

        // define a "jwt" guard.
        $this->authManager->extend('jwt', function ($app, $name, array $config) {
            // gets a instance of the token manager
            $tokenManager = $this->getTokenManager();

            // gets a instance of the user provider
            $userProvider = $this->getUserProvider($config['provider']);

            // creates a new guard instance passing a provider and a token manager
            $guard = new Guard($app, $name, $userProvider, $tokenManager);

            // set a event dispatcher on the guard.
            $guard->setDispatcher(resolve(Dispatcher::class));

            // returns the guard instance.
            return new Guard($app, $name, $userProvider, $tokenManager);
        });
    }
public function register()
    {
        // gets the auth factory instance and register on provider attribute.
        $this->authManager = $this->app->make(AuthManager::class);

        // register auth policies.
        $this->registerPolicies();

        // define a "jwt" guard.
        $this->authManager->extend('jwt', function ($app, $name, array $config) {
            // gets a instance of the token manager
            $tokenManager = $this->getTokenManager();

            // gets a instance of the user provider
            $userProvider = $this->getUserProvider($config['provider']);

            // creates a new guard instance passing a provider and a token manager
            $guard = new Guard($app, $name, $userProvider, $tokenManager);

            // set a event dispatcher on the guard.
            $guard->setDispatcher(resolve(Dispatcher::class));

            // returns the guard instance.
            return new Guard($app, $name, $userProvider, $tokenManager);
        });
    }
public function register ( ) { // gets the auth factory instance and register on provider attribute. $ this -> authManager = $ this -> app -> make ( AuthManager :: class ) ; // register auth policies. $ this -> registerPolicies ( ) ; // define a "jwt" guard. $ this -> authManager -> extend ( 'jwt' , function ( $ app , $ name , array $ config ) { // gets a instance of the token manager $ tokenManager = $ this -> getTokenManager ( ) ; // gets a instance of the user provider $ userProvider = $ this -> getUserProvider ( $ config [ 'provider' ] ) ; // creates a new guard instance passing a provider and a token manager $ guard = new Guard ( $ app , $ name , $ userProvider , $ tokenManager ) ; // set a event dispatcher on the guard. $ guard -> setDispatcher ( resolve ( Dispatcher :: class ) ) ; // returns the guard instance. return new Guard ( $ app , $ name , $ userProvider , $ tokenManager ) ; } ) ; }
Register Guard.
Register Guard .