I have some logic that works inside a controller but when I execute it in a job, QUEUE_DRIVER=database
, I'm getting some unexpected behavior.
Within my job, I call a configure
static method which sets a static property and then references it in the second (getFiles
) method call.
public function handle()
{
NICE::configure([
'accessKey' => config('nice.credentials.accessKey'),
'secretKey' => config('nice.credentials.secretKey')
]);
$niceFiles = NICE::getFiles($this->contact->contactId);
public static function getFiles($contactId)
{
$req = self::$guzzle->request('GET', self::apiURL('contacts/' . $contactId . '/files'), [
'headers' => [
There error I'm getting is I'm apparently calling request() on NULL (self::$guzzle).
Symfony\Component\Debug\Exception\FatalThrowableError: Call to a member function request() on null
Is there some under-the-hood Laravel magic I'm missing when using static properties and classes in a queued job?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire