Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access Request Filters From Lens' Fields Function #2405

Closed
MannikJ opened this issue Mar 3, 2020 · 2 comments
Closed

Access Request Filters From Lens' Fields Function #2405

MannikJ opened this issue Mar 3, 2020 · 2 comments

Comments

@MannikJ
Copy link

MannikJ commented Mar 3, 2020

Can I define a filter whose value I can retrieve inside the resolveUsing() callback of a field? The filter should not be applied globally, but within the field's callback.

It seems like out of the box I can only retrieve the value from within the query() function, because of the Laravel\Nova\Http\Requests\LensRequest vs. Illuminate\Http\Request.

@jbrooksuk
Copy link
Member

LensRequest extends NovaRequest which itself extends Request and it looks like we're passing an instance of NovaRequest to the fields() function, so you should be fine.

@MannikJ
Copy link
Author

MannikJ commented Mar 4, 2020

Ok, your are correct! It is in fact no problem with the request object passed to the fields function for the normal index query.
I use laravel-nova-excel to export the results, but for exporting the passed Maatwebsite\LaravelNovaExcel\Requests\ExportLensActionRequest (which is also a NovaRequest and has the filters function), does not hold the active filter values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants