1
0
Moell 9 жил өмнө
parent
commit
4de3c86407

+ 1 - 0
.gitignore

@@ -5,3 +5,4 @@ Homestead.yaml
 Homestead.json
 .env
 /.idea
+/public/uploads/avatar

+ 23 - 0
app/Presenters/PagiationPresenter.php

@@ -0,0 +1,23 @@
+<?php
+
+namespace App\Presenters;
+
+use Illuminate\Support\HtmlString;
+use Illuminate\Pagination\BootstrapThreePresenter;
+
+class PagiationPresenter extends BootstrapThreePresenter
+{
+    public function render()
+    {
+        if ($this->hasPages()) {
+            return new HtmlString(sprintf(
+                '<ul class="pagination pagination-sm no-margin pull-right">%s %s %s</ul>',
+                $this->getPreviousButton(),
+                $this->getLinks(),
+                $this->getNextButton()
+            ));
+        }
+
+        return '';
+    }
+}

+ 34 - 0
app/Providers/PaginationServiceProvider.php

@@ -0,0 +1,34 @@
+<?php
+
+namespace App\Providers;
+
+use App\Presenters\PagiationPresenter;
+use Illuminate\Pagination\Paginator;
+use Illuminate\Pagination\AbstractPaginator;
+use Illuminate\Support\ServiceProvider;
+
+class PaginationServiceProvider extends ServiceProvider
+{
+    /**
+     * Bootstrap the application services.
+     *
+     * @return void
+     */
+    public function boot()
+    {
+        //×Ô¶¨Òå·Öҳģ°å
+        Paginator::presenter(function (AbstractPaginator $paginator) {
+            return new PagiationPresenter($paginator);
+        });
+    }
+
+    /**
+     * Register the application services.
+     *
+     * @return void
+     */
+    public function register()
+    {
+        //
+    }
+}

+ 1 - 1
config/app.php

@@ -158,7 +158,7 @@ return [
         Barryvdh\Debugbar\ServiceProvider::class,
         Baum\Providers\BaumServiceProvider::class,
         Prettus\Repository\Providers\RepositoryServiceProvider::class,
-
+        App\Providers\PaginationServiceProvider::class,
     ],
 
     /*