Compatibility with JSON fields and laravel-translatable? #8
Unanswered
greatislander
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I've attempted to set up this package to encrypt a field that's stored as a JSON column and contains translated content (thanks to
spatie/laravel-translatable
. I based the JSON configuration on the examples shown here: https://github.com/paragonie/ciphersweet/releases/tag/v3.2.0I've created a very minimal test case with a fresh Laravel application here: greatislander/encrypted-translation@6bb73b7. It adds
spatie/laravel-ciphersweet
andspatie/laravel-translatable
as dependencies, configures theUser
model to support encrypted fields and translatable fields, and adds a translatablebio
field as a JSON column, configured via CipherSweet'saddJsonField
method with aJsonFieldMap
specifying that theen
andfr
fields in the JSON are text fields.I have two questions:
User
using my updated factory, I get the following error:Debugging determined that the field passed to the
encryptJson
method is a JSON string rather than an array:"{"en":"My bio in English.","fr":"Mon bio en fran\u00e7ais."}"
. I'm wondering if this transformation happens inspatie/laravel-translatable
or in Laravel itself.Thanks in advance for any guidance you can give me on this. I'd be happy to contribute patches to either this library or
spatie/laravel-translatable
to support their interoperability.Beta Was this translation helpful? Give feedback.
All reactions