[英]Manual pagination for union query in laravel 5.1?
我有聯合查詢,
$invoices = DB::table('invoices')
->select('id', 'client_id', 'created_at')
->where('client_id', '=', $id)
->whereNull('deleted_at');
$payments = DB::table('payments')
->select('id', 'client_id', 'created_at')
->where('client_id', '=', $id)
->whereNull('deleted_at');
return $invoices->union($payments)
->orderBy('created_at', 'asc')
->get();
在這里我要應用分頁,並且不支持分頁中的laravel buil。 但是我不了解手動分頁,在這里找到了一個手動分頁的答案-堆棧問題,但我無法解決我的問題。
是否有其他好的教程可以幫助我學習laravel 5.1中的手動分頁。
請幫我實現上述查詢的分頁嗎?
進行一些計算並將參數傳遞給方法->skip(100)->take(10)->get()
,其中跳過和獲取的工作方式類似於LIMIT 100, 10
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.