public function generateTokenByUser($user)
    {
        return $this->builder
                    ->set('user', $user)
                    ->sign(new Sha256(), env('JWT_SECRET'))
                    ->getToken();
    }
public function generateTokenByUser($user)
    {
        return $this->builder
                    ->set('user', $user)
                    ->sign(new Sha256(), env('JWT_SECRET'))
                    ->getToken();
    }
public function generateTokenByUser ( $ user ) { return $ this -> builder -> set ( 'user' , $ user ) -> sign ( new Sha256 ( ) , env ( 'JWT_SECRET' ) ) -> getToken ( ) ; }
Create object of a token.

@param array $user

@return Lcobucci\JWT\Token
Create object of a token .