Skip to content

Commit 0f2776a

Browse files
committed
Create PaginationView.php
1 parent 42ee619 commit 0f2776a

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ composer require ghabriel25/laravel-pagination-view
3333
## Usage
3434
> **Note:** Don't forget to include the necessary CSS files or link to the relevant CDN in your project to ensure proper styling!
3535
>
36+
3637
> All published views are located in `resources/views/vendor/pagination`
3738
3839
### [Fomantic UI](https://fomantic-ui.com) (Semantic UI)
@@ -54,7 +55,23 @@ class AppServiceProvider extends ServiceProvider
5455
}
5556
}
5657
```
58+
You could also directly use `Ghabriel\PaginationView\PaginationView` class
59+
```php
60+
<?php
61+
62+
namespace App\Providers;
63+
64+
use Ghabriel\PaginationView\PaginationView;
65+
use Illuminate\Support\ServiceProvider;
5766

67+
class AppServiceProvider extends ServiceProvider
68+
{
69+
public function boot(): void
70+
{
71+
PaginationView::fomanticuiView();
72+
}
73+
}
74+
```
5875
If you want to customize the view,
5976
```
6077
php artisan vendor:publish --provider=Ghabriel\PaginationView\PaginationViewServiceProvider --tag=pagination-view-fomanticui
@@ -82,7 +99,23 @@ class AppServiceProvider extends ServiceProvider
8299
}
83100
}
84101
```
102+
You could also directly use `Ghabriel\PaginationView\PaginationView` class
103+
```php
104+
<?php
105+
106+
namespace App\Providers;
85107

108+
use Ghabriel\PaginationView\PaginationView;
109+
use Illuminate\Support\ServiceProvider;
110+
111+
class AppServiceProvider extends ServiceProvider
112+
{
113+
public function boot(): void
114+
{
115+
PaginationView::bootstrapView();
116+
}
117+
}
118+
```
86119
If you want to customize the view,
87120
```
88121
php artisan vendor:publish --provider=Ghabriel\PaginationView\PaginationViewServiceProvider --tag=pagination-view-bootstrap
@@ -110,7 +143,23 @@ class AppServiceProvider extends ServiceProvider
110143
}
111144
}
112145
```
146+
You could also directly use `Ghabriel\PaginationView\PaginationView` class
147+
```php
148+
<?php
113149

150+
namespace App\Providers;
151+
152+
use Ghabriel\PaginationView\PaginationView;
153+
use Illuminate\Support\ServiceProvider;
154+
155+
class AppServiceProvider extends ServiceProvider
156+
{
157+
public function boot(): void
158+
{
159+
PaginationView::bulmaView();
160+
}
161+
}
162+
```
114163
If you want to customize the view,
115164
```
116165
php artisan vendor:publish --provider=Ghabriel\PaginationView\PaginationViewServiceProvider --tag=pagination-view-bulma

src/PaginationView.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace Ghabriel\PaginationView;
4+
5+
use Illuminate\Pagination\Paginator;
6+
7+
class PaginationView extends Paginator
8+
{
9+
/**
10+
* Indicates that Fomantic UI (Semantic UI) should be used as the default view.
11+
*
12+
* @return void
13+
*/
14+
public static function fomanticuiView(): void
15+
{
16+
static::defaultView('pagination::fomantic-ui');
17+
static::defaultSimpleView('pagination::simple-fomantic-ui');
18+
}
19+
20+
/**
21+
* Indicates that Bootstrap should be used as the default view.
22+
*
23+
* @return void
24+
*/
25+
public static function bootstrapView()
26+
{
27+
static::defaultView('pagination::bootstrap');
28+
static::defaultSimpleView('pagination::simple-bootstrap');
29+
}
30+
31+
/**
32+
* Indicates that Bulma should be used as the default view.
33+
*
34+
* @return void
35+
*/
36+
public static function bulmaView()
37+
{
38+
static::defaultView('pagination::bulma');
39+
static::defaultSimpleView('pagination::simple-bulma');
40+
}
41+
}

0 commit comments

Comments
 (0)