title: Laravel: Querying dynamically Time expressions
body: <p>In order to list all the articles (films) that are included in our catalog the current month I have written the following query using the Laravel:</p>
  
  <pre><code>    $current_month_film = DB::table('films')
          -&gt;join('categories', 'films.category_id', '=', 'categories.id')
          -&gt;select('films.*', 'categories.*')
          -&gt;whereMonth('films.created_at', '=', '12')
          -&gt;orderBy('films.created_at', 'desc')
          -&gt;get();
  </code></pre>
  
  <p>It works perfect. It shows 5 films were added this month. The only problem is that I am hard coding December (month = 12). Next month I will need to update to month = 1. And so on each month; that is a bad solution.</p>
  
  <p>The questions are:</p>
  
  <p>1- How could I get always the current month? Trying</p>
  
  <p><code>-&gt;whereMonth('films.created_at', '=', 'NOW')</code></p>
  
  <p>give back not error, but the list comes empty. In December there are 5 films added.</p>
  
  <p>2- I am showing a message in front end:</p>
  
  <pre><code>5 films added in Month 12
  </code></pre>
  
  <p>Is there a way to change the month = 12 into December and show a friendlier message like:</p>
  
  <pre><code>5 films added in December"
  </code></pre>
  
  <p>3- A better approach would be to show films included within the last 30 days. I did not find a time function for that.</p>