Thursday, January 29, 2015

Styling pagination for laravel

Laravel pagination is done pretty much automatically for you behind the scenes by calling ->paginate(x)
from your controller and return it to the view.
Aside from that simply go to your view and create a php block with the line $var->links();

Working behind the scenes is cool, but what if you want to style it to fit your liking or even to fit the design of your page.

After some searching I found a solution that works quite elegantly, I'll credit the source from below. The purpose of this blog entry is simply for my future reference.

Firstly, notice there is a file called
app/config/view.php
with a 'pagination' key and a value.
Change it to
'pagination' => 'file/path'.
 
Then, create app/views/file/path.blade.php and paste the following.
From there, freely modify the style name et cetera.

Credits to:

No comments:

Post a Comment