grardb
grardb
FFilament
Created by grardb on 1/4/2025 in #❓┊help
Is it possible to send POST data with `MenuItem::postAction()`?
I have a MenuItem in my Panel that I want to send a POST with:
MenuItem::make()
->label(
fn () => locale() === 'nl' ? 'English' : 'Nederlands'
)
->postAction(fn () => route('locale.update'))
->icon('heroicon-o-globe-alt'),
MenuItem::make()
->label(
fn () => locale() === 'nl' ? 'English' : 'Nederlands'
)
->postAction(fn () => route('locale.update'))
->icon('heroicon-o-globe-alt'),
However, I can't find any documentation on how to send POST data in the request. This route requires a locale field to be set. Is there a way to do this?
7 replies
FFilament
Created by grardb on 12/31/2024 in #❓┊help
Dynamic `required()`/`visible()` within a Repeater
I've got a Form with Select:
return $form
->schema([
Select::make('event_id')
->searchable(['event_locations.name'])
->live()
->relationship(...)
->preload()
->getOptionLabelFromRecordUsing(...),
return $form
->schema([
Select::make('event_id')
->searchable(['event_locations.name'])
->live()
->relationship(...)
->preload()
->getOptionLabelFromRecordUsing(...),
The Event model has certain attributes which inform the requirements of the form, e.g. $event->is_food_provided. Within a Fieldset, updating the visibility of a TextInput works:
Fieldset::make('Participant info')
->schema([
...
TextInput::make('dietary_requirements')
->visible(fn (Get $get) => Event::find($get('event_id'))?->is_food_provided),
Fieldset::make('Participant info')
->schema([
...
TextInput::make('dietary_requirements')
->visible(fn (Get $get) => Event::find($get('event_id'))?->is_food_provided),
However, this does not seem to work when it's inside a Repeater:
Repeater::make('participants')
->schema([
...
TextInput::make('dietary_requirements')
->visible(fn (Get $get) => Event::find($get('event_id'))?->is_food_provided),
]),
Repeater::make('participants')
->schema([
...
TextInput::make('dietary_requirements')
->visible(fn (Get $get) => Event::find($get('event_id'))?->is_food_provided),
]),
For the Repeater, the visible() check gets executed and is respected on page load, but not when the Select/Event is changed. Is this expected behavior, am I doing something wrong, or is this a bug? I couldn't find anything in the documentation or GitHub issues about this.
12 replies