title: Laravel query builder inject column value into Carbon query
body: <p>I've got a query that I'm running in my project on a model called <code>Domain</code>, it returns all domains where the status column of a domain matches <strong>complete</strong> and a date column is before or equal to a specific set of days.</p>
  <p>I've recently refactored the model columns and have included a new column called <code>domain_alert_period</code> which is an integer column that holds a value in days, I need to somehow target this column and put it in replace of my existing <strong>30</strong> so that the user is able to control the number of days prior to getting an alert.</p>
  <p>What am I missing from this to achieve this?</p>
  <pre class="lang-php prettyprint-override"><code>return Domain::where('status', 'complete')
              -&gt;where(function ($sql) {
                $sql-&gt;where('domain_expires_on', '&gt;', Carbon::now()-&gt;subDays(2)) // 2 days after expiry
                    -&gt;where('domain_expires_on', '&lt;', Carbon::now()-&gt;addDays(30)); // 30 days before expiry
              })
              -&gt;get();
  </code></pre>