How to know what arguments available inside a function?
I'm sure it's not Filament only question, it might closely related to the PHP itself.
For example, I would like to pre-process the data before saving it to the database. In this case I need to use
before
lifecycle hook for a CreateAction. I want to know how I can get the current form data inside this callback.
Documentation example show the function without any arguments.
While, other example show it with two arguments
If I use my text editor to see inside before declaration inside HasLifeCycleHook.php
it only has Closure.
I still don't understand how do I realize that any function in Filament can receive what kind of data?
Appreciate every information. Thank you guys.1 Reply
I think it’s mentioned in some part of the docs. Most of the time it’s the same params that are injected. They are defined in the
defaultEvaluationParameters()
method of the components.
For your usecase I think there is a mutateDataBeforeSave()
or similar method which would be more appropriate.