Конструктор запросов Laravel должен разбивать на страницы из нескольких таблиц соединения.
Я пробовал много способов разбить этот запрос на страницы. Но ничего.
Controller.php
$ord_heds = DB::select('select d.family, d.category, d.product_img, d.ord_ref, m.min_qty, m.max_qty, t.qty, t.value, SUM(replace(d.value,",","")) as ordval, SUM(replace(d.qty,",","")) as Tord_qty, COUNT(d.qty) as no_of_items_ordered, (select COUNT(itemCode) as mcount from item_statuses where '.'s'.$siteG.' ="'.$site.'" and itemCode in (select itemCode FROM items WHERE category=d.category and brand=d.family)) as manCount, (select COUNT(itemCode) as mcount1 from item_statuses where '.'s'.$siteG.' ="'.$site.'" and itemCode in (select itemCode FROM items WHERE category=d.category and brand=d.family and itemCode in (select itemcode FROM ord_dets where ord_dets.site = "'.$ordSite.'"))) as ordManCount FROM ord_dets d JOIN ord__heds h ON d.ord_ref = h.id INNER JOIN min__maxes m ON d.category = m.category AND d.site = m.site AND d.scode = m.season INNER JOIN targets t ON d.category = t.category AND d.family = t.brand AND d.month = t.month AND d.year = t.year AND d.site = t.site WHERE h.month = "'.$date[1].'" AND h.year = "'.$date[0].'" AND h.site = "'.$ordSite.'" GROUP BY d.family, d.category, d.product_img, d.ord_ref, m.min_qty, m.max_qty, t.qty, t.value');
$pag = $ord_heds->paginate(10);
dd($pag);
Над кодом выдается ошибка 'FatalThrowableError Вызов функции-члена paginate () для массива'.