title: Laravel: Comparing dates between two columns in database not working
body: <p>We are trying to build and api with our project. My problem is when I need to get a specific event which has a column <code>date_from</code> and <code>date_to</code> it always gets the data even if the event was finished. I want to get the specific event that is been for the rest of the two dates. My thing is when the <code>date_from</code> and the <code>date_to</code> equal or grater than the date today, It will show and after the date is finished it will not. Here are some of my codes.</p>
  
  <p>Index</p>
  
  <pre><code> public function index(Request $request)
      {
          $person = User::find(Auth::user()-&gt;id); 
          $now = Carbon::now()-&gt;toDateString();
          if(empty($person))
              return response()-&gt;json([
                  'code' =&gt; '03',
                  'status' =&gt; 'Invalid User'
              ], 403);
          $role = $person-&gt;role;
          if ($role == 2 || $role == 3) {
              $level = Event::active()-&gt;with(['groups'])
              -&gt;where('school_id', '=', $person-&gt;school_id)
              -&gt;where('group_id', '=', $role)
              -&gt;orWhere('group_id', '=', $person)
              -&gt;where('status', '=', 1)
              -&gt;where('active', '=', 1)
              -&gt;whereRaw("date_from &lt;=  date('$now')")
              -&gt;whereRaw("date_to &gt;=  date('$now')")
  
              -&gt;get();
  
  
              return response()-&gt;json($level);
          }
  </code></pre>
  
  <p>Result in Postman</p>
  
  <pre><code>{
          "id": 1,
          "name": "Final",
          "content": "&lt;p&gt;Sample&lt;/p&gt;",
          "group_id": 2,
          "event_date": "2019-09-01", 
          "date_from": "2019-09-20", //sept 20, 2019. The event started
          "date_to": "2019-10-03",//oct, 3 2019. The event end date. still gets the data even the date was not today.
          "time_from": "16:15:00",
          "time_to": "22:15:00",
          "event_place": "Room",
          "image": "",
          "school_id": 1,
          "smsnotify": 0,
          "appnotify": 1,
          "status": 1,
          "active": 1,
          "updated_by": null,
          "created_at": "2019-09-27 08:29:13",
          "updated_at": "2019-10-04 06:18:43",
          "users_id": 2,
          "groups": {
              "id": 2,
              "name": "Teachers",
              "description": "Teachers",
              "updated_by": null,
              "created_at": null,
              "updated_at": null
          }
      }
  </code></pre>