laravel-eloquent-spatial
laravel-eloquent-spatial copied to clipboard
Unable to JSON encode payload. Error code: 5
Thank you for your work on this package! I've been fighting an issue for the past week that I can't find a resolution to. I don't know if this is an issue with this package or Laravel but I thought that I would start here.
I have a queued job that has an object (not a model) as constructor argument. The object has property that is a model with a coordinates (Point) attribute.
something like:
class Report
{
$account = null;
public function __construct(Model $account) {
$this->account = $account
}
}
$account = Account::first();
MakeReport::dispatch(new Report($account));
The coordinates attribute is properly casted on the Account model
protected $casts = [
'coordinates' => Point::class
];
The problem is that the coordinates are not being serialized by laravel and I get the error:
Illuminate\ Queue\ InvalidPayloadException Unable to JSON encode payload. Error code: 5
Any ideas? I'm starting to lose my mind on this.
PHP 8.1.10 Laravel 9.28.0