title: laravel query between two dates from two date columns database
body: <p>I have a database <code>events</code> and it has 2 dates column named <code>date_from</code> which refers to start date and <code>date_to</code> refers to end date. The column <code>event_date</code> is when is the event posted. My question is how can I query this using the eloquent? I tried this code but it returns me an error. <code>Type error: Argument 2 passed to Illuminate\Database\Query\Builder</code></p>
  
  <p>Query</p>
  
  <pre><code>  $events = Event::where('school_id', '=', Auth::user()-&gt;school_id)
                        -&gt;where('status', '=', 1)
                        -&gt;where('active', '=', 1)
                        -&gt;whereRaw("group_id in('$role', '0')")
                        -&gt;whereBetween("date_from", "date_to" )
                        -&gt;limit(2)
                        -&gt;get();
  </code></pre>
  
  <p>Db structure</p>
  
  <p></p>
  
  <pre><code>| Field       | Type             | Null | Key | Default | Extra          |
  +-------------+------------------+------+-----+---------+----------------+
  | id          | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
  | name        | varchar(191)     | NO   |     | NULL    |                |
  | content     | text             | NO   |     | NULL    |                |
  | group_id    | int(11)          | NO   |     | NULL    |                |
  | event_date  | date             | YES  |     | NULL    |                |
  | date_from   | date             | YES  |     | NULL    |                |
  | date_to     | date             | YES  |     | NULL    |                |
  | time_from   | time             | YES  |     | NULL    |                |
  | time_to     | time             | YES  |     | NULL    |                |
  | event_place | varchar(191)     | NO   |     | NULL    |                |
  | image       | varchar(191)     | NO   |     |         |                |
  | school_id   | int(11)          | NO   |     | NULL    |                |
  | smsnotify   | int(11)          | NO   |     | 0       |                |
  | appnotify   | int(11)          | NO   |     | 0       |                |
  | status      | int(11)          | NO   |     | 0       |                |
  | active      | int(11)          | NO   |     | 0       |                |
  | updated_by  | varchar(191)     | YES  |     | NULL    |                |
  | created_at  | timestamp        | YES  |     | NULL    |                |
  | updated_at  | timestamp        | YES  |     | NULL    |                |
  | users_id    | int(11)          | YES  |     | NULL    |                |
  +-------------+------------------+------+-----+---------+----------------+
  </code></pre>