Level 2
Anybody that can help me with that?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
I have this RAW SQL statment:
SELECT created_at::date,
count('x') AS anzahl
FROM addresssurveys
WHERE created_at >= '2021-03-01'
AND created_at < '2021-03-31'
GROUP BY created_at::date
ORDER BY created_at
I tried to adapt it to Laravel:
Survey::select('created_at', DB::raw('count(*) AS anzahl '))->whereBetween('created_at', [$from, $to])->groupBy('created_at')->get();
How can I use the ::date inside the statment?
Please or to participate in this conversation.