Running PHP Function From Frontend Click - Component

I am losing braincells trying to figure this out but how do I call a one of my custom form component's php functions from a click event on my frontend? In V3 I used dispatchFormEvent but this doesn't seem to exist anymore.
3 Replies
awcodes
awcodes3w ago
Something like this. Check the Select field source code to see a more complete example.
#[ExposedLivewireMethod]
public function takeControl()
{
//
}
#[ExposedLivewireMethod]
public function takeControl()
{
//
}
<x-filament::button
x-on:click="await $wire.callSchemaComponentMethod(@js($getKey()), 'takeControl')"
>
{{ __('filament-gaze::gaze.lock_take_control') }}
</x-filament::button>
<x-filament::button
x-on:click="await $wire.callSchemaComponentMethod(@js($getKey()), 'takeControl')"
>
{{ __('filament-gaze::gaze.lock_take_control') }}
</x-filament::button>
Owain
OwainOP3w ago
Thanks, this worked ❤️

Did you find this page helpful?