kduma/eloquent-encryptable

为Laravel Eloquent模型添加加密字段的功能。

v1.2.0 2023-03-13 23:10 UTC

This package is auto-updated.

Last update: 2024-08-29 18:39:25 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License SensioLabsInsight StyleCI

为Laravel Eloquent模型添加加密字段的功能。

设置

将包添加到composer.json文件的require部分,并运行composer update

"kduma/eloquent-encryptable": "^1.1"

准备模型

在你的模型中添加以下行

use \KDuma\Eloquent\Encryptable;
protected $encrypted=['list', 'of', 'fields', 'you', 'wan\'t', 'to', 'encrypt'];

使用方法

它将自动加密和解密模型中定义在$encrypted属性中的字段。

这些字段必须是stringtext,用于较长的值。

YOTTARAM

特别感谢Jonathan Stavis,他是这个包的基础代码的原始创建者。

Packagist

在Packagist.org上查看此包: kduma/eloquent-encryptable