How to get $data from table form action?
I built a rather complex action in my table which looks like this:
This works perfectly fine and correctly sets the user's permissions in their project. The problem is that I am just not able to get the
$data
in the ->action
-method. After submitting the form the $data
seems to be empty:
[2024-05-08 08:31:58] production.DEBUG: Permissions data
So the ->action
-method is triggered correctly but is not getting any data back from the form?7 Replies
Relationships save on their own so the data is not included. I think you can use
->dehydrated(true)
?!Mh.. I added it to the form but it doesn't make any difference. The
$data
is still empty.
I tried both true and false and there is no difference at all. I just need to dispatch a custom event with the relationship data - that's why I need to "hook" into the submit action.There was a similar question here just some days ago. Thought the solution was using
dehydrated()
.Mh. Sorry I didn't see that question. I will try to search for it. But in this case
dehydrated()
does not seem to make any difference.Hm. Can't find it either π
Nevermind. I found another way by just using the
$record
in the action
directly and get the relationship after saving. So I can use that data to dispatch an Event:
You should add this after
->relationship()