A simple trait to encrypt attributes before saving to the database and to decrypt attributes before using their values
arzeroid/laravel-model-encryptable is a Laravel package for a simple trait to encrypt attributes before saving to the database and to decrypt attributes before using their values.
It currently has 0 GitHub stars and 7 downloads on Packagist (latest version v1.0.0).
Install it with composer require arzeroid/laravel-model-encryptable.
Discover more Laravel packages by arzeroid
or browse all Laravel packages to compare alternatives.
Last updated
A simple trait to encrypt attributes before saving to the database and to decrypt attributes before using their values.
Simply add the following line to your composer.json and run composer update
"arzeroid/laravel-model-encryptable": "^1.0",
Or use composer to add it with the following command
composer require "arzeroid/laravel-model-encryptable"
Add the trait to your model and set your attributes to be encrypted in encryptable array
<?php
namespace App\Models;
use Arzeroid\LaravelModelEncryptable\Encryptable;
class ActualPersonalCost extends BaseModel
{
...
use Encryptable;
/**
* The attributes that should be encrypted.
*
* @var array
*/
protected $encryptable = [
'cost',
];
...
}