Q:

Carbon and Eloquent times

I am trying to display all the entries entered within a specific time, from
 27-02-2018 22:00:00 to 28-02-2018 05:59:59,
here is what I got so far, but i am not getting any results back from the webpage
$NightStart='22:00:00';
   $NightEnd='05:59:59';
   $dcmlogs = log::with('users')->whereBetween('created_at',['Carbon::today()->toDateString() $NightStart','Carbon::yesterday()->toDateString() $NightEnd'])->paginate(10);

why I am not getting any results? I am sure there are some rows with these timestamps in the database.

A:

Php doesn't parse values inside ' only inside ":
Try:
$NightStart = '22:00:00';
$NightEnd = '05:59:59';
$today = Carbon::today()->toDateString() . ' ' . $NightStart;
$yesterday = Carbon::yesterday()->toDateString() . ' ' . $NightEnd;
$dcmlogs = log::with('users')->whereBetween('created_at',[$yesterday, $today])->paginate(10);

