1
$quantidade_week = DB::table('serviceorders')
->where('serviceorders.status_serviceorders', '=', 'OPENED')
->WhereDate('serviceorders.date_started_serviceorders', '>=', $firstDayOfInterval)
->WhereDate('serviceorders.date_started_serviceorders', '<=', $lastDayOfInterval)
->get()
->count();
dd($quantidade_week);
So @Guilherme Constamilam, I removed ->get, one more function to complicate the process, however, still persists resulting 0 records.
– Emilio Dami Silva
would not be because the date_started_serviceorders field is in format 2019-03-14 00:00:00 and the filter variable is 03/14/2019 ?
– Emilio Dami Silva
It’s very likely. Try passing in the same format, something like
->whereDate('serviceorders.date_started_serviceorders', '>=', date_create_from_format('d/m/Y', $firstDayOfInterval))
. An important observation, the correct one iswhereDate
and notWhereDate
– Costamilam
WOW! Thanks @Uilherme Costamilam Solved!!!!! I applied both tips and it worked perfect!
– Emilio Dami Silva
If the answer solved your problem mark it as accepted in the top left "v" button of the same
– Costamilam