public function edit(): Action
{
return Action::make('edit')
->icon('heroicon-m-pencil-square')
->iconButton()
->color('gray')
->form([
TextInput::make('title')
->maxLength(255),
MainSubjectSelect::make('parent_id')
->label('Parent element')
->columnSpanFull()
->statePath('parent_id'),
])
->action(function (array $arguments) {
$post = SubjectTree::find($arguments['post']);
$post->update([
'title' => request()->input('title'),
'parent_id' => request()->input('parent_id'),
]);
$this->emit('refreshItems'); // Emit an event to refresh the items list
});
}
public function edit(): Action
{
return Action::make('edit')
->icon('heroicon-m-pencil-square')
->iconButton()
->color('gray')
->form([
TextInput::make('title')
->maxLength(255),
MainSubjectSelect::make('parent_id')
->label('Parent element')
->columnSpanFull()
->statePath('parent_id'),
])
->action(function (array $arguments) {
$post = SubjectTree::find($arguments['post']);
$post->update([
'title' => request()->input('title'),
'parent_id' => request()->input('parent_id'),
]);
$this->emit('refreshItems'); // Emit an event to refresh the items list
});
}