You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
Did you find a solution or workaround for this @philkobby as I am in the same position, in that we use the Spatie/laravel-json-api-paginate package, and wanted to have our docs represent the pagination structure.
I am open to putting something together when I get some time, however thought I would check before diving too far in.
My thinking is it s'should' be relatively simple as Knuckles\Scribe\Extracting\Shared\TransformerResponseTools Line 31 just needs the ability to have a dynamic Paginator spun up.
Initial thought is to instantiate the Paginator using a specified class from in the Scribe config, and update the parser to allow additional config to be passed via the field arguments in the same way size is etc.
Interested to see if already solved as said, but if not what peoples thoughts are on this approach.
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 thepaginate()
method. However, Scribe seems to instantiate theIlluminate\Pagination\LengthAwarePaginator
class directly, which overrides the custom pagination class when generating documentation.Is there a workaround for Scribe to resolve the custom pagination class instead of Illuminate\Pagination\LengthAwarePaginator?
Docs
The text was updated successfully, but these errors were encountered: