SQL BETWEEN Two Columns in Laravel/Lumen
<p>Below is an excerpt from the Laravel documentation:</p>
<blockquote>
<p>The whereBetween method verifies that a column's value is between two values:</p>
<p><code>$users = DB::table('users')-&gt;whereBetween('votes', [1, 100])-&gt;get();</code></p>
</blockquote>
<p>But what if I want to find out if a value is between two columns in my database?</p>
<p>This is my raw SQL:</p>
<pre><code>SELECT a.*, b.name FROM restaurants a, restaurant_class b
WHERE a.restaurant_class_id = b.id
AND '$d' = CURRENT_DATE
AND '$t' BETWEEN a.saturday_ot AND a.saturday_ct
ORDER BY id DESC 
</code></pre>
<p><code>saturday_ot</code> and <code>saturday_ct</code> are <code>TIME</code> columns in my table and <code>$t</code> is a time variable. So I want to check if the time is in between the the times in both columns.</p>