Edit Action unexpected character
I have a table with an edit action.
This opens the modal, but as soon as I uncomment the form, I get an error saying:
And my table:
EditAction::make('edit')
->label('Rename')
->modalHeading('Rename Key')
->modalWidth('sm')
// ->form([
// Forms\Components\TextInput::make('name')
// ->label('Name')
// ->required()
// ->default(function ($record) {
// return $record->name;
// })
// ])
->action(function (array $data, $record) {
$record->update($data);
$this->service->sendNotification(
title: 'Successfully renamed key.',
success: true
);
}), EditAction::make('edit')
->label('Rename')
->modalHeading('Rename Key')
->modalWidth('sm')
// ->form([
// Forms\Components\TextInput::make('name')
// ->label('Name')
// ->required()
// ->default(function ($record) {
// return $record->name;
// })
// ])
->action(function (array $data, $record) {
$record->update($data);
$this->service->sendNotification(
title: 'Successfully renamed key.',
success: true
);
}),This opens the modal, but as soon as I uncomment the form, I get an error saying:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON dataSyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON dataAnd my table:
return $table
->query(Passkey::where('user_id', $this->user->getKey())) return $table
->query(Passkey::where('user_id', $this->user->getKey()))Solution
$data$data is used to get the modal form datahttps://filamentphp.com/docs/3.x/actions/modals#modal-forms