I have been testing this package for few days on Laravel 5.5. Recently, I've checked table content and some of the rows weren't encrypted at all.
After few tests in artisan tinker I've nailed the issue to updates that make the data unencrypted. Model creation works as expected.
The problem happens also in default L5.5 installation, using MySQL (MariaDB 10.1.26 exactly):
- Database and package setup:
composer create-project --prefer-dist laravel/laravel laravel55
cd laravel55
composer require delatbabel/elocryptfive
php artisan make:auth
php artisan migrate:fresh
(if there is an error with key length, change encoding values in config/database.php to 'utf8' and 'utf8_general_ci' accordingly)
- Add below to
app/User.php:
use Delatbabel\Elocrypt\Elocrypt;
class User extends Authenticatable
{
use Elocrypt;
[...]
protected $encrypts = [ 'name', ];
[...]
- add provider to ```config/app.php`
- Test in tinker:
>>> User::create(['name' => 'test', 'email' => 'test@example.com', 'password' => Hash::make('test')]);
The value for name is encrypted.
>>> User::find(1)->update(['email' => 'example@example.com']);
After the update table preview shows data as unecrypted.
I have been testing this package for few days on Laravel 5.5. Recently, I've checked table content and some of the rows weren't encrypted at all.
After few tests in
artisan tinkerI've nailed the issue to updates that make the data unencrypted. Model creation works as expected.The problem happens also in default L5.5 installation, using MySQL (MariaDB 10.1.26 exactly):
composer create-project --prefer-dist laravel/laravel laravel55 cd laravel55 composer require delatbabel/elocryptfive php artisan make:auth php artisan migrate:freshapp/User.php:The value for
nameis encrypted.After the update table preview shows data as unecrypted.