dimanche 25 octobre 2015

Manual pagination for union query in laravel 5.1?

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?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire