Executing code after record is created in Resource class
I have
I also have a permissions checkboxes defined in the form with
I need when a user is created, to call a method, like
This works when editing a record via the after() closure (
What is the best approach to do that?
UserResource with form() method to define create/edit modal & table with action() with EditAction::make().I also have a permissions checkboxes defined in the form with
CheckboxList() and the data is stored in an external DB table.I need when a user is created, to call a method, like
$record->syncPermissions($data['permissions']); to assign these permissions.This works when editing a record via the after() closure (
->after(static function (User $record, array $data) {), but I need this to work the same way when a new record is created?What is the best approach to do that?