As a first step I would restart the queue worker to make sure it is something odd with cached code in the worker threads
Queued mails throwing Query Builder exceptions
I’m running into a strange issue with mailables which are sent to a Redis queue. The jobs are failing with the exception message `BadMethodCallException: Method Illuminate\Database\Query\Builder::getDetailSummary does not exist. in /home/forge/.../vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:28.
I can open up tinker, grab a registration from the database and send it manually via the same mailable (e.g., Mail::send())with no problems. I’m scratching my head and probably missing something obvious. Running Laravel 5.7.20.
email blade template:
...
## Details
{!! $registration->getDetailSummary() !!}
...
EventRegistration model:
public function getDetailSummary(): string
{
return $this->getGolfDetailSummary();
}
public function getGolfDetailSummary($separator = '<br>'): string
{
return collect($this->details)
->reject(function ($val) {
return ! $val;
})
->map(function ($val, $key) {
return sprintf('%s: %s',
str_humanize($key),
$key == 'start_time'
? make_date($val, 'g:i a')
: $val
);
})
->implode($separator);
}
Don’t worry too much about the methods—they just format some output that is stored as JSON.
Please or to participate in this conversation.