RuiAlmeida
RuiAlmeida
FFilament
Created by RuiAlmeida on 9/16/2024 in #❓┊help
How to pass data to an EditAction
I'm struggling to make the editAction to recieve the record where I call the action in the livewire blade component In blade i have : {{ ($this->editAction)(['record' => $menu]) }} component:
class MenuComponent extends Component implements HasForms
public function editAction(): Action
{
return
Action::make('edit')
->fillForm(fn(ButteryMenu $record): array => [

'title' => $record->title,
...
])
->form(ButteryMenuResource::getFormSchema())

->action(function (array $data, array $arguments): void {
$record = ButteryMenu::find($arguments['record']->id);
$record->update($data);
$this->dispatch('buttery-menu-saved');
});
}
class MenuComponent extends Component implements HasForms
public function editAction(): Action
{
return
Action::make('edit')
->fillForm(fn(ButteryMenu $record): array => [

'title' => $record->title,
...
])
->form(ButteryMenuResource::getFormSchema())

->action(function (array $data, array $arguments): void {
$record = ButteryMenu::find($arguments['record']->id);
$record->update($data);
$this->dispatch('buttery-menu-saved');
});
}
Do i need anything in the mount() ? (I have a similar createAction in the compoenent that's working fine )
10 replies
FFilament
Created by RuiAlmeida on 9/15/2024 in #❓┊help
Opening modal from Livewire Component
I'm trying to open a modal from a livewire compoenent:
public function createAction(): Action
{
return Action::make('create')
->form(MenuResource::getFormSchema())
->label('Create');

}
public function createAction(): Action
{
return Action::make('create')
->form(MenuResource::getFormSchema())
->label('Create');

}
<div>
{{ $this->createAction }}
<x-filament-actions::modals />
</div>
<div>
{{ $this->createAction }}
<x-filament-actions::modals />
</div>
This does open the Modal, but without any of the syles from filament. Any ideas?
6 replies