3.0.0
What's Changed
Full Changelog: 2.2.0...3.0.0
Upgrade Guide
In 2.2.0 we introduced a new recommended way to encrypt data, which uses Laravel's Crypt::encryptString()
instead of Crypt::encrypt()
. This is now the default in v3. If you're migrating from 2.x and have existing data stored encrypted, but not using the recommendation in the 2.2.0 release note, you must migrate them (see instructions below).
Migrating Existing Encrypted Data
If you only have encrypted rich text attributes in your application, you may create a new migration and loop through the stored data, encrypting and decrypting it:
DB::table('rich_texts')->whereNotNull('body')->eachById(function ($richText) {
DB::table('rich_texts')
->where('id', $richText->id)
->update([
'body' => Crypt::encryptString(Crypt::decrypt($richText->body)),
]);
});
If you have a mix of encrypted and plain text rich text attributes, you will have to check if the $richText->field
and $richText->record_type
fields match the entities and attribute that are using encryption:
DB::table('rich_texts')
->whereNotNull('body')
->where('field', 'content')
->where('record_type', (new Post())->getMorphClass())
->eachById(function ($richText) {
DB::table('rich_texts')
->where('id', $richText->id)
->update([
'body' => Crypt::encryptString(Crypt::decrypt($richText->body)),
]);
});