AppServiceProvider.php 673 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App\Providers;
  3. use App\Tools\ApiPaginator;
  4. use Illuminate\Pagination\LengthAwarePaginator;
  5. use Illuminate\Support\ServiceProvider;
  6. class AppServiceProvider extends ServiceProvider
  7. {
  8. /**
  9. * Register any application services.
  10. */
  11. public function register(): void
  12. {
  13. //
  14. }
  15. /**
  16. * Bootstrap any application services.
  17. */
  18. public function boot(): void
  19. {
  20. //
  21. $this->app->bind(LengthAwarePaginator::class, function ($app, $options) {
  22. return new ApiPaginator($options['items'], $options['total'], $options['perPage'], $options['currentPage'], $options['options']);
  23. });
  24. }
  25. }