I am using laravel 5.1 i wants to create a common method which encrypt all the data with AES_ENCRYPT and when we fetch the data it will decrypt all the data.
i have try this in base model
public function setAttribute($key, $value)
{
if (in_array($key, $this->encryptable)) {
$value = DB::raw("AES_ENCRYPT('$value', '123456')");
}
return parent::setAttribute($key, $value);
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire