title: Laravel 5.1 Searching encrypt not working for me
body: <p>I'm working on this model with name field encrypted using Crypt class, i can display data into decrypted in view. but when searching for the value in the model that is encrypted. my controller returns null.</p>
  
  <p>//heres my code: validator model.
  //validator->validate($code)</p>
  
  <pre><code>return $this-&gt;validator
              -&gt;where('name', '=', $code)
              -&gt;where('date_end', '&gt;=', $dateToday)
              -&gt;where('availability', '=' ,0)
              -&gt;first();
  </code></pre>
  
  <p>//and note, im using traits for auto encryption and decryption for my model</p>
  
  <pre><code>trait Encryptable {
  
      public function getAttribute($key){
          $value = parent::getAttribute($key);
  
          if(in_array($key, $this-&gt;encryptable)){
               $value = Crypt::decrypt($value);
          }
  
          return $value;
      }
  
      public function setAttribute($key, $value)
      {
          if(in_array($key, $this-&gt;encryptable)){
              $value = Crypt::encrypt($value);
          }
  
          return parent::setAttribute($key, $value);
      }
  
  }
  </code></pre>
  
  <p>please help.</p>