F
Filamentβ€’2w ago
StanProg

Executing code after record is created in Resource class

I have 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?
3 Replies
Want results from more Discord servers?
Add your server