How can I pass $state to a static function for a reusable Column/Input?
I have 6 columns for different states. But all of them follow the same convention. So, I would rather not keep repeating the code. I created the following static method.
Now, I want to call this static function within columns array.
One thing I found, is a recent video posted on #💫┊announcements about enums. But this will be a lot of code, too. I prefer a single function.
3 Replies
You don’t need to pass state to the column. Just the column / field name.
The $state in the method callbacks will be injected based on the name in make()
But the column/field name is being passed as a string to the function. So, you can't access the value.
You don’t need to access the value.
On my phone so can’t really provide an example at the moment.