heppi75's avatar

Pass a parameter via static nova action to resource

I want to redirect with a nova action to an other nova page and pass a parameter with it. How can this be done in the actions section and how can I grab this parameter on the other nova resource in the fields section?

Also $this->id is always empty? How can I access it for the current row?

Thank you!

public function actions(NovaRequest $request)
    {
        return [
            Action::redirect('Create Action', '/nova/resources/offers/new?id=' . $this->id)
                ->standalone()->onlyOnTableRow()->withoutConfirmation()->withMeta(['id' => $this->id])
        ];
    }
0 likes
5 replies
heppi75's avatar

I'm one step further. What I found out is that a redirect in the handle of a NovaAction works. But then I have the problem that I can't access the query parameter in the fields area of ​​the resource.

public function handle(ActionFields $fields, Collection $models)
    {
        return ActionResponse::redirect('/nova/resources/offers/new?id=' . $models->first()->id);
    }

The question remains whether it is not possible with the static redirect in the actions? It wouldn't matter if it worked via the handle function and the action response method. Nevertheless, the question remains how I can access the query parameter in the Fields area. In the NovaResponse is no query parameter, and I can also not access it via the global response().

One way would be to go via session, but then I can't see any difference from where the user called the action, via the action or via the resource's new button.

I didn't think that something so trivial would keep me busy for so long. But I am relative new to nova ... - hope someone can help me with this ...

hari122's avatar

on how $this-> id is working for me is not working

1 like
hari122's avatar

iwant to update a status of category but but table does n't contain id primary contain only slug that is unique id need to send the slug how to send that slug

Please or to participate in this conversation.