PHP code example of hihaho / laravel-encryptable-trait
1. Go to this page and download the library: Download hihaho/laravel-encryptable-trait library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hihaho / laravel-encryptable-trait example snippets
namespace app\Models;
use Illuminate\Database\Eloquent\Model as Eloquent;
use HiHaHo\EncryptableTrait\Encryptable;
class Phone extends Eloquent
{
use Encryptable;
protected $encryptable = [
'imei',
];
}
namespace app\Models;
use Illuminate\Database\Eloquent\Model as Eloquent;
use HiHaHo\EncryptableTrait\Encryptable;
class Phone extends Eloquent
{
use Encryptable;
protected $encryptable = [
'imei',
];
protected $dontThrowDecryptException = true;
}
$phone = Phone::find(1);
$phone->imei; //Will return null