oleander29/decrypt

Laravel package to decrypt an Eloquent model or collection based on a variable set in the model class

Installs: 25

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:laravel-package

dev-master 2016-02-12 23:47 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:36:36 UTC


README

This is a little laravel package which takes a collection or an Eloquent model and decrypts the fields of either every model in the collection which are defined in the $encryptable variable in your model(read below) or a model depending of what function you use, it returns the model or collection as an array, so it is mostly usable when wanting to return some json like if you are creating an API, all you need to do is encode it.

Installation

To install just add this to your composer.json "oleander29/decrypt": "dev-master" then run composer update.

After this add the service provider to the config/app.php file like so Oleander29\Decrypt\DecryptServiceProvider::class

And lastly add an alias in the same file(config/app.php) like so 'Decrypt' => 'Oleander29\Decrypt\DecryptServiceFacade'

Remember to add a variable to your model so the package can see what fields it can decrypt and what it should not, you need to add the following variable:

protected $encryptable = [ 'field1', 'field2', ];

To use the decrypter and it's functions just add use Decrypt; on top of your file, and you can then use the following functions like so:

  • Decrypt::collection($collection);
  • Decrypt::model($model);