thomascombe / encryptable-fields
This package is abandoned and no longer maintained.
The author suggests using the webqamdev/encryptable-fields package instead.
Laravel Backpack Fields Encryptable
1.2.0
2019-11-21 20:16 UTC
Requires
- php: ^7.1
- illuminate/support: >=5.8
Requires (Dev)
- orchestra/testbench: 3.8.*
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2020-05-12 16:09:27 UTC
README
Allow you to encrypt some model fields. You can add a hashed field to allow sql query
Installation
You can install the package via composer:
composer require webqamdev/encryptable-fields
You can publish config via artisan:
php artisan vendor:publish --provider="Webqamdev\EncryptableFields\EncryptableFieldsServiceProvider"
Usage
<?php namespace App\Models; use Webqamdev\EncryptableFields\Models\Traits\EncryptableFields; class User extends { use EncryptableFields; const COLUMN_USER_LASTNAME = 'user_lastname'; const COLUMN_USER_LASTNAME_HASH = 'user_lastname_hash'; const COLUMN_USER_FIRSTNAME = 'user_firstname'; const COLUMN_USER_FIRSTNAME_HASH = 'user_firstname_hash'; const COLUMN_USER_MAIL = 'user_mail'; protected $encryptable = [ self::COLUMN_USER_FIRSTNAME => self::COLUMN_USER_FIRSTNAME_HASH, self::COLUMN_USER_LASTNAME => self::COLUMN_USER_LASTNAME_HASH, self::COLUMN_USER_MAIL, ];
Create
User::create( [ User::COLUMN_USER_FIRSTNAME => 'watson', User::COLUMN_USER_LASTNAME => 'jack', ] );
To find Model :
User::where(User::COLUMN_USER_FIRSTNAME_HASH, User::hashValue('watson'));
or
User::whereEncrypted(User::COLUMN_USER_FIRSTNAME, 'watson')->get()
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.