jeudi 2 février 2017

Laravel Guzzle Request gets wrong DB Connection

I am trying to make a request from one Laravel project to another. The issue that I am getting is that the second Laravel is using the first Laravel Database Connection. So it is complaining that a table does not exist.

Here is the code that I am using.

$data = ['test' => 'foobar'];
$client = new \GuzzleHttp\Client();
$url = getenv('API_BASE') . 'stock-list';

$res = $client->request('POST', $url, [
    'headers' => [
        'X-Public' => getenv('API_PUBLIC'),
        'X-Hash' => ApiService::Encrypt(getenv('API_PRIVATE'), json_encode($data)),
    ],
    'json' => $data,
    'http_errors' => false,
]);

echo "<pre>" . print_r($res->getBody()->getContents(), true) . "</pre>";

Has anyone ever come across something like this?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kZWpRk
via IFTTT

Aucun commentaire:

Enregistrer un commentaire