Skip to content
This repository was archived by the owner on Jun 9, 2024. It is now read-only.

Commit 1dda11e

Browse files
committed
add read
1 parent ab06c3f commit 1dda11e

File tree

1 file changed

+94
-2
lines changed

1 file changed

+94
-2
lines changed

README.md

+94-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,94 @@
1-
# pagination
2-
Laravel 5 Custom Pagination Presenter
1+
# Landish/Pagination
2+
3+
[Laravel 5](http://laravel.com/) comes with [Pagination](http://laravel.com/docs/5.0/pagination) class, which is perfectly rendered to match [Bootstrap 3](http://getbootstrap.com/components/#pagination) styles.
4+
5+
This package gives you ability to change the display output of rendered pagination elements for Front-end Frameworks, such as: [Semantic UI](http://semantic-ui.com/collections/menu.html#pagination), [Zurb Foundation](http://foundation.zurb.com/docs/components/pagination.html) and [UIKit](http://getuikit.com/docs/pagination.html).
6+
7+
8+
## Installation
9+
To install `landish/pagination` package, you have to run the following command in your Terminal, or Comand Promt:
10+
11+
```
12+
composer require landish/pagination
13+
```
14+
15+
Or manually add the following lines in to your `composer.json` file:
16+
17+
```json
18+
"require": {
19+
"landish/pagination": "~1.0"
20+
}
21+
```
22+
23+
and run the `composer update` or `composer install` command.
24+
25+
## Usage
26+
27+
Add following lines of code in your `*.blade.php` file, where you want to dispay the pagination.
28+
29+
For [Semantic UI](http://semantic-ui.com/):
30+
```
31+
{!! (new Landish\Pagination\SemanticUI($items))->render() !!}
32+
```
33+
34+
For [Zurb Foundation](http://foundation.zurb.com/):
35+
36+
```
37+
{!! (new Landish\Pagination\ZurbFoundation($items))->render() !!}
38+
```
39+
40+
For [UIKit](http://getuikit.com/):
41+
42+
```
43+
{!! (new Landish\Pagination\UIKit($items))->render() !!}
44+
```
45+
46+
## Usage ( Recommended )
47+
48+
If you display pagination on several pages of your web application and have to write to the output code in several files, then this is, what I would recommend to do:
49+
50+
Just create `Pagination.php` file in your `/app/` directory and paste the following code:
51+
52+
```php
53+
<?php namespace App;
54+
55+
use Landish\Pagination\SemanticUI;
56+
57+
class Pagination extends SemanticUI {
58+
59+
}
60+
```
61+
62+
In that case, you only have to add the following code in your blade template files:
63+
64+
```
65+
{!! (new App\Pagination($items))->render() !!}
66+
```
67+
68+
And in future, if you decide to override the output of pagination elements, it will be much more easier to change in `app/Pagination.php` file, rather then in several blade template files.
69+
70+
## Additional Wrappers
71+
72+
If you need to add additional wrappers to your pagination output, which will be displayed only if items have pages, then you can do it like this:
73+
74+
```
75+
@if($items->hasPages())
76+
<div class="pagination-wrapper">
77+
<div class="pagination-wrapper-inner">
78+
{!! (new App\Pagination($items))->render() !!}
79+
</div>
80+
</div>
81+
@endif
82+
```
83+
84+
Of course, you are free to change the `.pagination-wrapper` and `.pagination-wrapper-inner` CSS classes and the HTML.
85+
86+
## Appending To Pagination Links
87+
88+
[Appending to pagination links](http://laravel.com/docs/5.0/pagination#appending-to-pagination-links) gives you ability to add extra query strings to your pagination links.
89+
90+
With this package you can do it with following lines of code:
91+
92+
```
93+
{!! $items->appends(['key' => 'value'])->render(new App\Pagination($items)) !!}
94+
```

0 commit comments

Comments
 (0)