hgacreative / encryptable
A useful trait for Laravel models to leverage to encrypt/decrypt sensitive data on the fly
dev-master
2019-03-15 14:22 UTC
Requires
- php: >=7.0
This package is auto-updated.
Last update: 2025-02-16 04:28:54 UTC
README
This package works with Laravel to allow any model to have encryptable attribues encrypted and decrypted on-the-fly in a very eloquent/Laravel fashion.
We opt to ignore encrypting or decrypting null values when accessing and mutating attributes so that we can use Laravel's $model->whereNull()
and $model->whereNotNull()
query builder methods.
Use the Hgacreative\Encryptable\Encryptable
trait within the relevant models and copy the following code:
/**
* The attributes which should be encrypted in the database
*
* @var array
*/
protected $encryptable = [
//
];