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
I'm using Laravel Jetstream and each Team has a number of Reviews. I want to export those Reviews. If I place the DownloadExcel action on the Team resource:
public function actions(NovaRequest $request)
{
return [
(new DownloadReviews)->onlyOnDetail()
];
}
I need to modify the query (I assume?):
class DownloadReviews extends DownloadExcel implements FromQuery, WithHeadings, WithMapping
{
public function query()
{
return Reviews::query()
->where('team_id', request()->resourceId) //This does not work
->latest('created_at');
}
}
The question is, how do I access the Team resource/model in the query function?
The text was updated successfully, but these errors were encountered:
I think the way actions are built in Nova, you would have to add the action to the Reviews resource instead and than show the team's reviews on the team/show page.
I'm not sure how to get the resourceId the way you are trying, that would be a question to the Nova team.
I'm using Laravel Jetstream and each Team has a number of Reviews. I want to export those Reviews. If I place the DownloadExcel action on the Team resource:
I need to modify the query (I assume?):
The question is, how do I access the Team resource/model in the query function?
The text was updated successfully, but these errors were encountered: