Skip to content

Column with type point throws error #908

@weogrim

Description

@weogrim
Q A
Bug? yes
New Feature? no
Framework Laravel
Framework version 10.10
Package version 13.6
PHP version 8.1

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 on audits table (when update only this field, new_values and old_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

  1. Create table with column with type Point.
  2. Create model for this table
  3. Do basic setup of auditing for this model.
  4. Try to edit point field, you will get empty arrays.
  5. Try to delete row, you get exception

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 the point field into two decimal fields lat and long, but if there is any solution, I would like to be able to use the point type

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions