PHP code example of waseem / laravel-data-encryption

1. Go to this page and download the library: Download waseem/laravel-data-encryption 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/ */

    

waseem / laravel-data-encryption example snippets


    'providers' => [
        ...
        \Waseem\Encipher\EncipherServiceProvider::class,
    ],

    use Waseem\Encipher\Encipher;
    

    protected $encipher = ['encrypted_property'];
    

    
    
    namespace App;
    
    use Illuminate\Database\Eloquent\Model;
    use Waseem\Encipher\Encipher;
    
    class User extends Model
    {
    
        use Encipher;
    
        /**
         * The attributes that should be encrypted when stored.
         *
         * @var array
         */
        protected $encipher = [ 'email', 'name' , 'mobile'];
     
        /**
        * Optionally you can define the attributes that should be converted to camelcase when retrieve.
        *
        * @var array
        */
         protected $camelcase = ['name'];
    }
    
      
   $validator = validator(['email'=>'[email protected]'], ['email'=>'exists_encrypted:users,email']);
    
      
    $rules=array(
        'email' => 'unique_encrypted"=>"The email has already been taken."
    );
    
      
   $validator = User::where('email','[email protected]')->first();
   
bash
     php artisan vendor:publish --provider=Waseem\Encipher\EncipherServiceProvider