title: How to update the table depending upon the dates in laravel query builder or sql
body: <p>I am facing issue in updating records in table. My user_plans table look like below:</p>
  
  <pre><code>id  remaning_images transaction_id  user_id   start_date      expiry_date   status  
   1  100               100             1       2018-09-22      2019-09-22    Active
   2  50                101             2       2018-10-20      2019-10-20    Active
   3  50                102             3       2018-10-21      2019-10-21    Active
   4  50                103             4       2018-10-19      2019-10-19    Active
  </code></pre>
  
  <p>I want to update the <code>remaning_images</code> column to <code>250</code> and it will update when 30 days done See example below:</p>
  
  <ul>
  <li>My 1st record start date is <strong>sept 22 2018</strong></li>
  <li>When <strong>22nd oct 2018</strong> comes, I want to update remanaing images column to <code>250</code></li>
  <li>When <strong>22nd Nov 2018</strong> will come again column will update to <code>250</code>. it will work till <code>expiry_date</code> column as mentioned. </li>
  <li>And same behavior will work for other transactions.</li>
  </ul>
  
  <p>I want to do this thing with <code>sql</code> query or laravel query builder.</p>
  
  <p>I have actually done with php with getting all plans and update one by one. But i think that would not work if my transactions are in hundreds of thousands or in millions.</p>
  
  <p>So i want to run using sql query.  I am not sure may be it will done using Case statements.</p>