public function requestAsync($url, $method = 'GET', $data = [])
    {

        $stack = HandlerStack::create();
        $stack->push(ApiMiddleware::auth());
        $client = new Client(['handler' => $stack]);

        $promise = $client->requestAsync($method, $url, [
            'headers' => [
                'Authorization' => 'Bearer ' . $this->token
            ],
            'json' => $data,
            'content-type' => 'application/json'
        ]);

        return $promise;

    }
public function requestAsync($url, $method = 'GET', $data = [])
    {

        $stack = HandlerStack::create();
        $stack->push(ApiMiddleware::auth());
        $client = new Client(['handler' => $stack]);

        $promise = $client->requestAsync($method, $url, [
            'headers' => [
                'Authorization' => 'Bearer ' . $this->token
            ],
            'json' => $data,
            'content-type' => 'application/json'
        ]);

        return $promise;

    }
public function requestAsync ( $ url , $ method = 'GET' , $ data = [ ] ) { $ stack = HandlerStack :: create ( ) ; $ stack -> push ( ApiMiddleware :: auth ( ) ) ; $ client = new Client ( [ 'handler' => $ stack ] ) ; $ promise = $ client -> requestAsync ( $ method , $ url , [ 'headers' => [ 'Authorization' => 'Bearer ' . $ this -> token ] , 'json' => $ data , 'content-type' => 'application/json' ] ) ; return $ promise ; }
Guzzle async request
@param $url
@param string $method
@param array $data
@return \GuzzleHttp\Promise\PromiseInterface
Guzzle async request