text: Q:
  
  Laravel 5.8 Eloquent whereBetween fails
  
  I am stuck with an error on an Eloquent query.
  My query:
  $mtd_hits = Usage::selectRaw("
          SUM(table_hits) AS hits,
      ")
      ->where('user_id', '=', $user->id)
      ->whereBetween('created_at', [$from_date, $to_date])
      ->first();
  
  In my Usage class:
  public $timestamps = true;
  
  protected $dates = ['created_at', 'updated_at'];
  
  My $from_dateand $to_date are Carbon instances:
  $from_date:
  Carbon @1556323200 {#1416 ▼
    date: 2019-04-27 00:00:00.0 UTC (+00:00)
  }
  
  $to_date:
  Carbon @1558915200 {#1622 ▼
    date: 2019-05-27 00:00:00.0 UTC (+00:00)
  }
  
  By my query fails with:
  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from `usage` where `user_id` = ? and `created_at` between ? and ? limit 1' at line 3 
  (SQL: select SUM(table_hits) AS hits, from `usage` where `user_id` = 2 and `created_at` between 2019-04-27 00:00:00 and 2019-05-27 00:00:00 limit 1)
  
  Apologies in advance if this is a silly question.
  
  A:
  
  its all about your raw query !
  try removing , from your code
  also you can see your query by using ->toSql() method
  
  