Reputation: 2379
I have union query ,
$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();
Here I want to apply pagination and laravel buil in pagination will not be supported. But I don't know about manual pagination and found one answer here manual pagination - stack question but I couldn't solve my issue.
Is there any other good tutorial which help me to learn manual pagination in laravel 5.1.
Please help me to implement pagination for above query?
Upvotes: 0
Views: 874
Reputation: 423
Make some calculations and pass params to methods ->skip(100)->take(10)->get()
, where skip and take works like LIMIT 100, 10
Upvotes: 1