Answer the question
In order to leave comments, you need to log in
How to fix 500 error when fetching Laravel Eloquent records?
Good afternoon, I encountered such a situation, I have a large database of about 1 million lines.
It is necessary to generate statistics of orders by day.
I do it like this:
$orders = Order::filter(Order::query());
$orders->where('status', 1)->get()->groupBy(function($item){ return $item->created_at->format('Y-m-d'); });
// Вот при последним запросе, выбивает 500 ошибка. Пытаюсь получить записи за последние 30 дней, около 60.000 строк.
Answer the question
In order to leave comments, you need to log in
"Error 500" is fixed in the logs, read them to find out what exactly is wrong.
Maybe you don't have enough memory for the script, or maybe the created_at field is empty somewhere - it could be anything.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question