Closed weogrim closed 3 months ago
I haven't used that data type, did you try adding a custom cast to the model? https://laravel.com/docs/10.x/eloquent-mutators#custom-casts
protected $casts = [
'your_point_field' => YourPointCustomCaster::class,
];
Actual Behaviour
I have field in DB storing spatial data, and more specifically
point
type in MySQL. When I create model or edit this field, it is not stored onaudits
table (when update only this field,new_values
andold_values
is empty array). When try to delete model, i get exception:Unable to encode attribute [old_values] for model [OwenIt\Auditing\Models\Audit] to JSON: Malformed UTF-8 characters, possibly incorrectly encoded.
in./vendor/laravel/framework/src/Illuminate/Database/Eloquent/JsonEncodingException.php
Expected Behaviour
Somehow, store spatial data change.
Steps to Reproduce
Point
.point
field, you will get empty arrays.If this is expected behavior, can you point me to some idea how to fix this in my application? Unfortunately i cannot skip this field with
$auditExclude
, i need this data history. I can split thepoint
field into two decimal fieldslat
andlong
, but if there is any solution, I would like to be able to use thepoint
type