title: Laravel selecting count (of rows created TODAY) using MySQL date functions
body: <p>I want the the user to only be able to create a certain number submissions per day. This is what I used in CakePHP to get the number of submissions a user had made on that day and it worked:</p>
  
  <pre><code>$submitted_today = $this-&gt;Submission-&gt;find('count', array(
                  'conditions' =&gt; array(
                      'Submission.ip' =&gt; $_SERVER['REMOTE_ADDR'],
                      'Submission.created &gt;= CURRENT_DATE',
                      'Submission.created &lt; CURRENT_DATE + INTERVAL 1 DAY'
                  )
              ));
  </code></pre>
  
  <p>Here's what I came up with in Laravel:</p>
  
  <pre><code>$submitted_today = DB::table('submissions')
                      -&gt;where('ip', '=', $_SERVER['REMOTE_ADDR'])
                      -&gt;where('created', '&gt;=', 'CURRENT_DATE')
                      -&gt;where('created', '&lt;', 'CURRENT_DATE + INTERVAL 1 DAY')
                      -&gt;get();
  </code></pre>
  
  <p>But it doesn't work. What's wrong with it? Might it have something to with the MySQL date terms getting interpreted as strings?</p>
  
  <hr>
  
  <p><strong>UPDATE:</strong> Here's the code using whereRaw that (appears) to work.</p>
  
  <pre><code>$submitted_today = DB::table('submissions')
                      -&gt;where('ip', '=', $_SERVER['REMOTE_ADDR'])
                      -&gt;whereRaw('created &gt;= CURRENT_DATE')
                      -&gt;whereRaw('created &lt; CURRENT_DATE + INTERVAL 1 DAY')
                      -&gt;count();
  </code></pre>