knuckleswtf/scribe

Custom pagination clsss

philkobby opened this issue · 1 comments

Scribe version

4.37

Your question

Hi, I have a custom pagination class that extends Illuminate\Pagination\LengthAwarePaginator, and it's been bound in the service container. This works fine with the paginate() method. However, Scribe seems to instantiate the Illuminate\Pagination\LengthAwarePaginator class directly, which overrides the custom pagination class when generating documentation.

  #[ResponseFromApiResource(
        TaskCollection::class,
        Task::class,
        paginate: 15,
        status: 200,
        description: 'Request was successful',
        collection: true,
    )]

    public function index(Request $request)
    {
        return new TaskCollection(Task::paginate(15));
        //paginations are generated as expected but the documentation does not follow the same format as expected
    }

Is there a workaround for Scribe to resolve the custom pagination class instead of Illuminate\Pagination\LengthAwarePaginator?

Docs

I guess we could change it to go through the service container. PR welcome!