jetiradoro/laravel-encrypt-model

Encrypt data before insert database

1.0 2019-02-01 12:09 UTC

This package is auto-updated.

Last update: 2024-04-29 04:00:05 UTC


README

This component allows you encrypt data before insert in database, and auto decrypt when you get the attribute

Installation

  1. With Composer : download files
composer require jetiradoro/laravel-encrypt-model
  1. In your model you need use Encryptable Trait and define $encryptable array with fields which you want encrypt.
  • Example
class User extends Model
{
    use Encryptable;

    protected $encryptable = [
        'cc',
        'ss',
        'phone',
    ];
}
...

This component has been inspired in https://laracasts.com/discuss/channels/laravel/encrypting-model-data article