Edit Action unexpected character

I have a table with an edit action.
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 data
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
And my table:
return $table
->query(Passkey::where('user_id', $this->user->getKey()))
return $table
->query(Passkey::where('user_id', $this->user->getKey()))
4 Replies
LeandroFerreira
what is the output from $data?
Jamie Cee
Jamie Cee5w ago
I don't know, it doesn't get that far. If I have the ->form() uncommented, the modal doesnt even open
Jamie Cee
Jamie Cee5w ago
Ah, I missed the fillForm part, thank you
Want results from more Discord servers?
Add your server