nsdonner's avatar

How to get flterd data by time?

Hi, fellas.

I have a very big table with meteo data, and want to query rows between some dates, not all, but, for example, for every 1 hour period and with pagination.

So now i have all raws by

		$data = MeteoHistory::whereDevice($id)
        ->where('created_at', '<=', $end_date)
        ->where('created_at', '>=', $start_date)
        ->whereIn('dataType', $indicators)
        ->orderBy('created_at')
        ->with(['MeteoDevice', 'MeteoDataTypes'])
        ->paginate($count_per_page)
        ->appends([
            'start_date' => $start_date,
            'end_date' => $end_date,
            'count_per_page' => $count_per_page
         ]);

how can i have this data limited/filterd for every 1 hour period, based on created_at field and with working pagination?

0 likes
0 replies

Please or to participate in this conversation.