javiersalcedoj
How to Execute a Function on Button Click and Component Render in Custom Filament Fields?
Hi,
To achieve your goal of creating a custom field with a button that executes the sendOtp function when clicked and also calls this function when the component is rendered for the first time, you can follow these steps:
Component:
First, make sure to set up the action in your AuthField class:
Blade:
Then, update your Blade template to call the sendOtp function when the button is clicked and when the component is initialized:
With these changes, the sendOtp function will be called both when the component is rendered initially and when the button is clicked.
5 replies