mufasil/laravel_model_keys_encryption

此包用于加密数据库中像 'Id' 这样的键。

dev-master 2019-08-15 13:03 UTC

This package is auto-updated.

Last update: 2024-09-16 00:03:02 UTC


README

通过本库提供的特质,轻松加密您的表 'Id'。

当您将数据库值公开时,加密这些值非常重要。此包将简化您的操作,只需两步即可完成。

注意 - 此特质不会为您创建数据库列。您必须创建自己的迁移

需求

此包需要 Laravel 5.6。Laravel 的早期版本具有不同的模型实现,与此包不兼容。

安装

composer require mufasil/laravel_model_keys_encryption

使用方法

将特质添加到您的模型中

您只需包含想要加密的列。

以下示例将加密用户表的 id 属性。

use Mufasil\KeyEncryption\Traits\Encryptable;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    use Encryptable;
    
    protected static $encryptable = [
        'id',
    ];
}

就是这样。享受...