Deprecated
Eloquent Encryptable
Eases using and generating slugs Laravel Eloquent models.
Package EOL: This package is no longer maintained. Since Laravel 8, the framework includes built-in encrypted casts which provide the same functionality natively. Please migrate to native encrypted casts:
protected $casts = [
'secret_field' => 'encrypted',
'secret_array' => 'encrypted:array',
];
Setup
Add the package to the require section of your composer.json and run composer update
"kduma/eloquent-encryptable": "^1.1"
Prepare models
In your model add following lines:
use \KDuma\Eloquent\Encryptable;
protected $encrypted=['list', 'of', 'fields', 'you', 'wan\'t', 'to', 'encrypt'];
Usage
It will be automatically encrypting and decrypting fields defined in $encrypted property of your model.
Those fields must be string or text for longer values.