'string', 'payload' => 'array', 'queue' => 'string', 'exception' => 'string', 'failed_at' => 'datetime', ]; /** * Add a local scope to handle jobs associated in a queue */ public function scopeQueuedAt(Builder $query, string $queue): Builder { return $query->where('queue', $queue); } /** * Return the core exception message without the full exception trace */ public function exceptionMessage(): string { if (isValidJson($this->exception)) { $exception = json_decode($this->exception); return $exception->message . ' in ' . $exception->file . ' at ' . $exception->line; } return preg_replace('/\s+/', ' ', trim(explode('Stack trace', $this->exception)[0])); } }