setToken() public method

Set the current JWT token
public setToken ( string $token ) : self
$token string
return self
 /**
  * Create a new JWT token object from the token in the request
  *
  * @param Request|null $request
  *
  * @return JwtToken
  *
  * @throws NoTokenException
  */
 public function jwtToken($request = null)
 {
     $token = $this->getToken($request);
     if (!$token) {
         throw new NoTokenException('JWT token is required.');
     }
     $driver = $this->makeDriver();
     $jwt = new JwtToken($driver);
     $jwt->setToken($token);
     return $jwt;
 }
 /**
  * Validate JWT token before passing on to the next middleware
  *
  * @param \Illuminate\Http\Request $request
  * @param Closure                  $next
  */
 public function handle($request, Closure $next)
 {
     $token = $this->getTokenFromRequest($request);
     $this->jwt->setToken($token)->validateOrFail();
     return $next($request);
 }