add_header 'Access-Control-Allow-Origin' '*';
add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, HEAD";
add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept";
| 2023-01-06 | -100 |
| 2023-01-07 | -100 |
| 2023-01-08 | -100 |
SELECT requests.*, comments.text
FROM (SELECT export_id, max(imported_at) AS imported_at
FROM requests
GROUP BY export_id) as t
JOIN requests ON requests.export_id = t.export_id
AND requests.imported_at = t.imported_at
LEFT JOIN comments ON comments.spreadsheet_export_id = t.export_id
ORDER BY `requests`.export_id DESC
DB::enableQueryLog();
$categories = Category::with(['products' => function ($q) {
$q->where('active', 1)->orderBy($this->sortField, $this->sortAsc ? 'asc' : 'desc');
}])->orderBy('sorting')->get();
dd(DB::getQueryLog());
select * from categories order by sorting;
select * from products where category_id in (здесь список id полученных в первом запросе) and active = 1 order by sortField asc;