© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•7mo ago•
6 replies
shabxs

mutateFormDataBeforeSave() do not showing related record data. v4

I am using spatie roles with user and i am using

https://filamentphp.com/docs/4.x/forms/checkbox-list#integrating-with-an-eloquent-relationship

in the UserForm to update the roles along with other user details.

Everything is working fine, the user is getting updated and roles are also properly getting update. (wondering how this is happening behind the scene)

Now i want to perform some activity log (currently using spatie activity log and Ralph J. Smit activity plugin)

Now inside
protected function mutateFormDataBeforeSave(array $data): array
{

// cant access related roles before saving

return $data;
}

also

inside
protected function handleRecordUpdate(Model $record, array $data): Model
{
// $record already has updated roles
return $record;
}

Help required
1. where to access these roles update before being associated with user model
2. When i update only roles and saves, i dont get any activity logged in (spatie), but when i change any user data, the activity is logged. Is there any way i can add activity by default on update of roles.
Checkbox list - Forms - Filament
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Record not showing
FilamentFFilament / ❓┊help
16mo ago
Summariser showing related data in group
FilamentFFilament / ❓┊help
3y ago
How to Use mutateFormDataBeforeFill or mutateFormDataBeforeSave for Related Data in Relationships
FilamentFFilament / ❓┊help
2y ago
mutateFormDataBeforeSave
FilamentFFilament / ❓┊help
2y ago