В моем проекте я использовал DB: выберите с UNION шесть таблиц и ORDER BY . Как я могу добавить нумерацию страниц к этому запросу в структуре Laravel?
Я уже пробовал с нумерацией документации Laravel, но не могу разбить на страницы с запросом UNION из шести таблиц.
public function publishAds()
{
$id = Auth::user()->id;
$data = City::all();
$ads = DB::select("(SELECT id,title,updated_at,'Commercial Properties' as
'type',town,city,rent_per_month,image1,add_status,'commercial_properties' as
tableName,type as adType from commercial_properties WHERE add_status='published'
AND user_id=$id) union (select id,title,updated_at,'House',town,city,rent_per_month,
image1,add_status,'houses',type from houses WHERE add_status='published'
AND user_id=$id ) union (select id,title,updated_at,'Land',town,city,rent_per_month,
image1,add_status,'lands',type from lands WHERE add_status='published'
AND user_id=$id ) union (select id,title,updated_at,'Apartment',town,city,
rent_per_month,image1,add_status,'apartments',type from apartments
WHERE add_status='published' AND user_id=$id ) union (select id,title,updated_at,
'Holyday Rental',town,city,rent_per_month,image1,add_status,'holyday_rentals',
type from holyday_rentals WHERE add_status='published' AND user_id=$id ) union
(select id,title,updated_at,'Room',town,city,rent_per_month,image1,add_status,
'rooms',type from rooms WHERE add_status='published' AND user_id=$id ) order
by updated_at DESC,rand()");
return view('admin/my-add', ['ads' => $ads, 'cities' => $data, 'status' => 'Publish Ads']);
}
Я хочу получить нумерацию страниц для этого запроса, который включает шесть UNION.