dates in between excluding weekends or selected weekdays
Opened this issue · 3 comments
hasajacykacperek commented
seansch commented
I'm curious about this as well, I have daily data that isn't updated on the weekends so my charts looks similar to yours.
seansch commented
I realized that Trend::model returns a Laravel collection and can be filtered, so I used a filter like this:
$data = $data->filter(function ($item) {
return $item->aggregate > 0;
})->values();
Make sure you add values()
to the end of your filter so it re-indexes the array keys(I fought with that for a while).
TwilightDuck commented
You can use the ::query()
function to add SQL WHERE clause to filter out the weekends.
DAYOFWEEK(booked_date) <> 1 AND DAYOFWEEK(booked_date)<>7