What different Action method `using` and `action` ?

I want overwrite logic CRUD Action. What method can i use to overwrite it using CreatePostAction, UpdatePostAction, DeletePostAction?
EditAction::make()
->using(function (Model $record, array $data): Model {
$record->update($data);

return $record;
})
EditAction::make()
->using(function (Model $record, array $data): Model {
$record->update($data);

return $record;
})
and
Action::make('sendEmail')
->form([
TextInput::make('subject')->required(),
RichEditor::make('body')->required(),
])
->action(function (array $data) {
Mail::to($this->client)
->send(new GenericEmail(
subject: $data['subject'],
body: $data['body'],
));
})
Action::make('sendEmail')
->form([
TextInput::make('subject')->required(),
RichEditor::make('body')->required(),
])
->action(function (array $data) {
Mail::to($this->client)
->send(new GenericEmail(
subject: $data['subject'],
body: $data['body'],
));
})
1 Reply
Matthew
Matthew5h ago
Are you trying to write something to do a little more than the standard edit \ create ? If so, you're already there with ->using Just write a handler and call it from that method.

Did you find this page helpful?