bvipul/laravel-encrypts-attributes

此包将用于加密模型属性。

dev-master 2018-05-30 05:44 UTC

This package is not auto-updated.

Last update: 2024-09-29 05:09:20 UTC


README

目的:此包将用于加密模型属性。

使用此包

您可以通过执行以下命令在您的laravel安装中安装此包

composer require bvipul/laravel-encrypts-attributes

之后,将提供者添加到 config/app.php

配置

安装包后,在您的 config/app.php 配置文件中注册 Bvipul\EncryptsAttributes\EncryptsServiceProvider::class

'providers' => [
    // Other service providers...

    Bvipul\EncryptsAttributes\EncryptsServiceProvider::class
],

之后,您可以将此包提供的特性添加到模型中,例如我在 User.php 模型文件中所做的那样。

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Bvipul\EncryptsAttributes\Traits\EncryptsAttributes;

class User extends Authenticatable
{
    use Notifiable,
        EncryptsAttributes;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];
}

问题

如果您遇到任何问题,请在此处报告:here

贡献

请随时为该项目创建任何pull请求。如果您想向项目中添加任何新更改或功能,您可以给我们发邮件至 basapativipulkumar@gmail.com

许可

MIT许可