How to inject a livewire component into form builder?
Hello to all of you beautiful human beings,
I was working on a simple resource - create form. Part of the form contains a DatePicker. The context is order processing. In most cases, the default value would be "now()" or todays date (YYYY-MM-DD). However I wanted to add a few buttons such as 'Today / Yesterday / 2 Days Ago / 3 Days Ago' that when clicked, auto populates the date picker value to be whatever date matches the button action - if no button action - then the user can anyway freely edit the form and the default is anyway
now()
.
I have trouble finding what the best way to accomplish this. I thought initially I could create a Livewire component through the php artisan make:livewire blahblah
command:
and a blade template:
Then in my form builder I was hoping to inject Livewire::make('App\Livewire\FulFillmentFragmentDateCompletedHelper
but then I realize I may need to create an entirely custom form based through livewire.
What would be the best way to achieve this? Is there a way to inline an input field based on a custom livewire component along the normal form schema or what would be the ideal way to implement something like this? Appreciate any pointers!1 Reply
you may need instead of making a separate livewire component
https://filamentphp.com/docs/3.x/forms/fields/custom