Sole Action - Allow Prefill current resource values and validation #6064
Unanswered
sidneyprins
asked this question in
Ideas & Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently it is possible to create and update resources. When updating, all values will be prefilled based on what that resource has defined. However, when using actions, you do not have that data. Validation does also not work on fields.
Lets assume we have a start_date and end_date. end_date always needs to be on or after start_date. In your resource you can define something like this
->rules(['nullable', 'date', 'after_or_equal:start_date'])However, due to business logic, we do not want to update the resource directly with an end_date. Because for example, a mail to the user needs to be sent, or some other logic needs to happen beside that. By having it in an action, an admin user also knows that it will execute some flow.
The logic is still the same: end_date cannot be before start_date. We can add rules to fields in an Action
->rules(['nullable', 'date', 'after_or_equal:start_date'])But there's several problems here:
My suggestion is to allow Sole Actions, that only can be executed for one resource, to be able to know which resource is being modified and allow the rules and prefilling to work.
Beta Was this translation helpful? Give feedback.
All reactions