Oleander2911 / Decrypt by coleander

Laravel package to decrypt an Eloquent model or collection based on a variable set in the model class
25
0
2
Package Data
Maintainer Username: coleander
Maintainer Contact: kontakt@mboweb.dk (Christoffer Oleander Nielsen)
Package Create Date: 2016-02-12
Package Last Update: 2016-02-12
Home Page: https://github.com/Oleander2911/Decrypt
Language: PHP
License: MIT
Last Refreshed: 2025-02-21 15:08:26
Package Statistics
Total Downloads: 25
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Decrypt

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);