Warning We have decided to stop maintaining this package.
Consider to use Attribute Casting of type
hashed
.
Laravel Hash Fields automatically hash model fields.
You can install the package via composer:
composer require datalogix/laravel-hash-fields
The package will automatically register itself.
Your Eloquent models should use the Datalogix\HashFields\HashFields
trait.
Here's an example of how to implement the trait:
namespace App;
use Datalogix\HashFields\HashFields;
use Illuminate\Database\Eloquent\Model;
class YourEloquentModel extends Model
{
use HashFields;
}
You can also override of property fieldsToHash
.
By default the package will hashed password
field.
/**
* The model's fields to hash.
*
* @var array
*/
protected static $fieldsToHash = [
'password',
];