TacvaLoca
TacvaLoca
FFilament
Created by TacvaLoca on 11/21/2023 in #❓┊help
Trying to open createOptionAction
I'm trying to open a createOptionAction from a livewire component that's in a modal called from a viewField, I already tried to use {{ $this->modal }} inside the livewire component's blade but it only added a 1 the the modal. Not sure how to proceed since {{ $this->modal }} worked on diferent ocassions but not on this one. Calling of the livewire component in modal
<x-filament::modal id="edit_employee_contract" width="5xl">
@livewire('edit-contract-employee', ['employee_id' => $getRecord()->id, 'modal' => '1', 'modal_id' => 'edit_employee_contract'])
</x-filament::modal>
<x-filament::modal id="edit_employee_contract" width="5xl">
@livewire('edit-contract-employee', ['employee_id' => $getRecord()->id, 'modal' => '1', 'modal_id' => 'edit_employee_contract'])
</x-filament::modal>
The component where I'm trying to open the createOptionAction
php
Select::make('department_id')
->label(__('employees.contracts_tab.department'))
->options(Department::all()->pluck('name', 'id'))
->searchable()
->required()
->createOptionForm([
TextInput::make('name')
->required(),
])
->createOptionAction(function (Forms\Components\Actions\Action $action) {
return $action
->modalButton(__('employees.create_department_button'))
->modalHeading(__('employees.create_department'))
->modalWidth('xl');
})
->createOptionUsing(function ($data) {
return Department::create($data)->getKey();
}),
php
Select::make('department_id')
->label(__('employees.contracts_tab.department'))
->options(Department::all()->pluck('name', 'id'))
->searchable()
->required()
->createOptionForm([
TextInput::make('name')
->required(),
])
->createOptionAction(function (Forms\Components\Actions\Action $action) {
return $action
->modalButton(__('employees.create_department_button'))
->modalHeading(__('employees.create_department'))
->modalWidth('xl');
})
->createOptionUsing(function ($data) {
return Department::create($data)->getKey();
}),
2 replies