jeudi 12 octobre 2017

I wants to encrypt all my data with AES_ENCRYPT AND AES_DECRYPT using my laravel version 5.1. help neede

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