<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
adityadarma / laravel-database-cryptable example snippets
use AdityaDarma\LaravelDatabaseCryptable\Traits\CryptableAttribute;
class User extends Eloquent {
use CryptableAttribute;
/**
* The attributes that should be encrypted on save.
*
* @var array
*/
protected $encryptable = [
'first_name', 'last_name'
];
}
namespace App\Http\Controllers;
use App\Models\User;
class UsersController extends Controller {
public function index(Request $request)
{
$user = User::whereEncrypted('first_name','john')
->orWhereEncrypted('last_name','!=','Doe')
->orderByEncrypted('last_name', 'asc')
->firstOrFail();
return $user;
}
}