title: How to use Model's getter Attribute to use in Query Builder
body: <p>Described below is my getter in my <code>Post</code> model:</p>
  
  <pre><code>public function getTicketIdAttribute() {
     return str_pad($this-&gt;id, 6, '0', STR_PAD_LEFT);
  }
  </code></pre>
  
  <p>Note that the function simply adds 6 zero padding at the front of the <code>Post</code>'s <code>post_id</code>.</p>
  
  <p>Now, is it possible to use it in a query builder? Ihave tried the following:</p>
  
  <pre><code>Post::where(function($query) use ($keyword) {
     $query-&gt;where('detail', 'LIKE', '%'. $keyword .'%')
           -&gt;orWhereHas($query-&gt;getTicketIdAttribute(), 'LIKE', '%'. $keyword .'%');
  });
  </code></pre>
  
  <p>What I'm trying to do is to have a search engine which look for <code>Post</code> object <strong>if</strong>:</p>
  
  <ol>
  <li><code>$keyword</code> matches the <code>Post</code>'s <code>detail</code></li>
  </ol>
  
  <p><strong>or</strong></p>
  
  <ol start="2">
  <li>if <code>$keyword</code> matches the <code>getTicketIdAttribute()</code></li>
  </ol>