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 models within fields function in Nova Actions #1029
Comments
This is out of the scope for actions, but you could probably accomplish by redirecting from the action to your own tool which would do the ajax call and let you finish out the action. |
+1, I'd like this ability as well. |
@davidhemphill, access the model from fields methods is not out of scope. In some situations, it's very importante. See this example (my case)
But to choose one sector (that belongs to company) I must pass some data to Fields function (company or sectors). I know I can attach this action in sector, but after each import, the user will have to back to company page, scroll down to sector, open a new sector detail page and click in action again. If I could get the Company model from fields method in action, I could show a select with just the sector of the company, and this will be a better experience to the user (click action, choose sector, choose file, click upload. To import new users, justs: click action, chooose new sector, choose file, upload). I know I can build a ResourceTool for this, but this shold be covered by action, because that's the reason actions exists. Please, allow access the model (id or object) from fields method. |
I would also like to see this. One approach might be to allow the |
while i am sending mails from a action, i am not able to prefill the receiver of the mail with model data.. accessing models in action fields would be super |
For single model actions (
|
@BrunoRB, I tryed My workarround is:
This way, when I run the action, i don't care about the optionValues. |
I believe |
Same here, Otherwise, the action is tasteless |
It would be good that we can pass model to fields in Nova Action |
Both request()->resourceId and request()->viaResourceId return null any suggestion? |
@tititorn You can use |
I needed something similar, not quite the same, for changing the currency and locale of a field based on the store information. this was what I did.
Then I used an extended currency field:
Then I can do this:
You could adapt this for other methods too, just have a read through the code to find where you need to insert it in. Tbh, I think the best way to resolve this on nova's end is to add a bunch more callbacks to allow for this sort of use case as I see it being fairly frequently used; at least for me. |
Why is this issue closed when there are many people who need it? |
Made it work inspired by the stack overflow link above (thanks @ljmoleiro )
|
Yes it's a great solution, thanks! |
this solution does not work for bulk acitons, where we could use |
This issue definitely should be re-opened. |
Hello all, during this time has anyone maybe found a solution to this? |
This might come handy... https://github.com/tunezilla/nova-dynamic-action-fields |
@davidhemphill @crynobone this needs to be reopened. |
We never open old issues, more so if the issue is related to a version no longer supported by Nova. You can start new discussion or question |
Hey guys,
I am sending the models within an action to some webservice. The results should be displayed in a select field where the user can choose a suitable option for him.
Is there a way to access the models within the fields function?
Thanks
The text was updated successfully, but these errors were encountered: