How to write an Eloquent query to search created_at between two dates? Basically, I am trying to get sales records between two days. e.g. 24/05/2015 to 25/05/2015 or today's sale.
/*Not sure if we need to use get() method though, you can use a Carbon instances with the dates if you want*/
$sales = Sales::whereBetween('created_at', [$date1, $date2])->get();
Thanks. How can I find whether the date I have given is a valid date? $date_from = '01-01-2015' or $date_from = 'false'; I am getting InvalidArgumentException if I provide any wrong input. Is there any way to validate date?