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(), ]; } }; }); } }