lundi 25 mai 2020

Laravel: ErrorException: Trying to get property of non-object

I keep getting ErrorException: Trying to get property of non-object in a Job I am running.
I am running:

$appData = $this->getAppData()

if ($appData->pending_validation) {
 //
}

public function getAppData()
{
    $apiKey = env('APP_SETUP_KEY');
    $client = new Client(['x-api-key'=> $apiKey]);

    $response = $client->request(
        'GET',
        'https://apps.customendpoint.com/app',
        [
            'headers' => [
                'x-api-key' => $apiKey,
            ],
        ]);

    return $response->getBody()->getContents();
}

The error is occuring on $appData->pending_validation but when I go to log $appData, I get: {"blocked":true,"pending_validation":true}



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3bYNry5
via IFTTT

Aucun commentaire:

Enregistrer un commentaire