How to enable pagination in laravel-4.1 when using query builder.
Here is my function from model.
public static function getTransactions( $accountCode ) {
$accountId = Account::getAccountId( $accountCode );
$object = DB::table('transactions')
->orderBy('transactionId', 'ASC')
->where('fkAccountId', $accountId)
->where('fkUserId', Auth::user()->userId);
->get();
return $object;
}
public static function getTransactions( $accountCode ) {
$accountId = Account::getAccountId( $accountCode );
$object = DB::table('transactions')
->orderBy('transactionId', 'ASC')
->where('fkAccountId', $accountId)
->where('fkUserId', Auth::user()->userId);
->paginate(10);
return $object;
}
and
echo $object->links(); //links
http://laravel.com/docs/pagination#usage
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With