Package Data | |
---|---|
Maintainer Username: | jivemonkey2000 |
Maintainer Contact: | mralees@me.com (Andrew Lees) |
Package Create Date: | 2017-01-12 |
Package Last Update: | 2020-08-27 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-19 03:00:25 |
Package Statistics | |
---|---|
Total Downloads: | 120 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
A place for helpful collection of Laravel bits and bobs to reside.
##Eloquent ###AttributeEncryption
Add attribute level encryption to your Eloquent models in just a few steps:
Larabits\Eloquent\AttributeEncryption
at the top of your class$encrypt
array property and populate it with attributes you wish to encryptuse AttributeEncryption
to your Eloquent modelsJust like this:
<?php
use Illuminate\Database\Eloquent\Model;
use Larabits\Eloquent\AttributeEncryption;
class User extends Model
{
use AttributeEncryption;
/**
* The attributes that should be encrypted.
*
* @var array
*/
protected $encrypt = [
'email',
'secret',
];
}
If required, encryption can be enabled and disabled by using your .env
file to set an APP_ENABLE_ENCRYPTION
constant false
. This is sometimes useful for testing, for example when using seeInDatabase('table',['foo' => 'bar']);
.
To install Larabits, either add it your composer.json
or do a composer require jivemonkey2000/larabits
from your project root.
composer require jivemonkey2000/larabits