I am passing a request to a job class to send an email for a contact form. The issue is that I cannot directly access the property.
I set the $request in the constructor as $this->request = $request;
In the handle()
method, I do this:
\Log::info( 'job-contact-request', [ 'request' => $this->request ] );
the log spits out:
[2018-06-30 14:07:34] local.INFO: request {"request":"[object] (App\Events\ContactRequestValidated: {\"request\":{\"client_name\":\"Daniel\",\"client_email\":\"email@email.com\",\"client_phone\":\"1234567891\",\"client_text\":\"blargle carble darble zarble\"},\"socket\":null})"}
Which shows that the client_email is set. But when I try to access $this->request->client_email
, I get:
[2018-06-30 14:15:30] local.ERROR: Undefined property: App\Events\ContactRequestValidated::$client_email {"exception":"[object] (ErrorException(code: 0): Undefined property: App\Events\ContactRequestValidated::$client_email at /var/www/site/laravel/app/Jobs/SendContactRequestEmail.php:36) [stacktrace]