laravel-database-encryption icon indicating copy to clipboard operation
laravel-database-encryption copied to clipboard

Encrypting JSON Field Types

Open LaravelLover069 opened this issue 3 years ago • 0 comments

Hi Elgibor,

I am using your package to encrypt sensitive PII which works fine for string values and numbers. When it comes to encrypting JSON fields however the encryption fails upon the following command:

php artisan encryptable:encryptModel 'App\Customer'

PHP Warning: Module 'mbstring' already loaded in Unknown on line 0 342 records will be encrypted

ErrorException openssl_encrypt() expects parameter 1 to be string, array given

In the customer model I have added the following:

namespace App;

use Illuminate\Database\Eloquent\Model;
use ESolution\DBEncryption\Traits\EncryptedAttribute;

class Customer extends Model
{
    use EncryptedAttribute;

    protected $encryptable = [
        'details'
    ];
}

Please advise how to apply the encryption command on fields containing JSON data.

Many thanks in advance!

LaravelLover069 avatar Mar 20 '21 16:03 LaravelLover069