first commit
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Common\Providers;
|
||||
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class PaginationProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->bind('Illuminate\Pagination\LengthAwarePaginator', function ($app, $options) {
|
||||
return new class(
|
||||
$options['items'],
|
||||
$options['total'],
|
||||
$options['perPage'],
|
||||
$options['currentPage'],
|
||||
$options['options']
|
||||
) extends LengthAwarePaginator {
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'data' => $this->items(),
|
||||
'total' => $this->total(),
|
||||
'pageSize' => $this->perPage(),
|
||||
'current' => $this->currentPage(),
|
||||
];
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user