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
In the upgrade guide, it mentions replacing all macros calls to using the methods on the QueryBuilderRequest class. The examples don't work as they don't have the proper request object. There are a couple of possible ways to do this however.
Change app(QueryBuilderRequest::class)->includes() to something like app(QueryBuilderRequest::class)->fromRequest(app('request'))->includes()
Inform the user to add a binding for QueryBuilderRequest in AppServiceProvider::register()
$this->app->bind(QueryBuilderServiceProvider::class, function ($app) {
return QueryBuilderRequest::fromRequest($app['request']);
})
Update the QueryBuilderServiceProvider to include a register method and the binding from above.
The last two offer the ability to also inject the QueryBuilderRequest instead of the Laravel Request class in to controllers.
A note on the guide that these methods do not accept arguments would also be helpful.
The text was updated successfully, but these errors were encountered:
You're right! I'll add some info and a link to this issue in the upgrade guide. I didn't feel like having adding the request class to the service container as it didn't have much use in the package but I can see this being valueable in the context of a controller.
On the method arguments: the macros were deprecated a while ago and it's easy enough to call contains on any of the QueryBuilderRequest methods. I'll add a note for that too.
In the upgrade guide, it mentions replacing all macros calls to using the methods on the QueryBuilderRequest class. The examples don't work as they don't have the proper request object. There are a couple of possible ways to do this however.
Change
app(QueryBuilderRequest::class)->includes()
to something likeapp(QueryBuilderRequest::class)->fromRequest(app('request'))->includes()
Inform the user to add a binding for QueryBuilderRequest in
AppServiceProvider::register()
QueryBuilderServiceProvider
to include a register method and the binding from above.The last two offer the ability to also inject the QueryBuilderRequest instead of the Laravel Request class in to controllers.
A note on the guide that these methods do not accept arguments would also be helpful.
The text was updated successfully, but these errors were encountered: