F
Filamentβ€’14mo ago
Shaung Bhone

Method Filament\Tables\Actions\Action::deactivateAction does not exist.

Where am I do wrong?
Tables\Actions\Action::make('deactivate')
->form([
Forms\Components\Textarea::make('remark')
->string()
->required(),
Forms\Components\TextInput::make('password')
->password()
->required()
->unique(User::class, 'password'),
])
->deactivateAction()
//

public function deactivateAction()
{
$this->action(function (User $record): void {
$record->deactivateLog()->updateOrCreate([
'remark' => $record->remark,
]);
});

return $this;
}
Tables\Actions\Action::make('deactivate')
->form([
Forms\Components\Textarea::make('remark')
->string()
->required(),
Forms\Components\TextInput::make('password')
->password()
->required()
->unique(User::class, 'password'),
])
->deactivateAction()
//

public function deactivateAction()
{
$this->action(function (User $record): void {
$record->deactivateLog()->updateOrCreate([
'remark' => $record->remark,
]);
});

return $this;
}
Solution:
If you want this, you need to implement that method on your action
Jump to solution
4 Replies
cheesegrits
cheesegritsβ€’14mo ago
You are doing lots of things wrong. πŸ™‚ You can't just invent methods to chain on to Filament's components like that. Or in PHP in general. That's not how this works. And in your action() code you need to inject the $data array from your form. Try this.
Tables\Actions\Action::make('deactivate')
->form([
//
])
->action(function (User $record, array $data): void {
$record->deactivateLog()->updateOrCreate([
'remark' => $data['remark'],
]);
})
Tables\Actions\Action::make('deactivate')
->form([
//
])
->action(function (User $record, array $data): void {
$record->deactivateLog()->updateOrCreate([
'remark' => $data['remark'],
]);
})
Shaung Bhone
Shaung BhoneOPβ€’14mo ago
I just want to call
->deactivateAction()
->deactivateAction()
like that
Dennis Koch
Dennis Kochβ€’14mo ago
You CAN'T like this
Solution
Dennis Koch
Dennis Kochβ€’14mo ago
If you want this, you need to implement that method on your action
Want results from more Discord servers?
Add your server