© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
5 replies
thyk123

how to mutateFormDataBeforeCreate inside simple resource?

Hello, i want to ask how to use mutateFormDataBeforeCreate inside simple resouce

because i try to add here
use App\Filament\Resources\CashflowResource;
use Filament\Actions;
use Filament\Resources\Pages\ManageRecords;

class ManageCashflows extends ManageRecords
{
    protected static string $resource = CashflowResource::class;
    
    protected function getHeaderActions(): array
    {
        return [
            Actions\CreateAction::make(),
        ];
    }

    protected function mutateFormDataBeforeCreate(array $data): array
    {
        $data['user_id'] = auth()->id();
    
        return $data;
    }
}
use App\Filament\Resources\CashflowResource;
use Filament\Actions;
use Filament\Resources\Pages\ManageRecords;

class ManageCashflows extends ManageRecords
{
    protected static string $resource = CashflowResource::class;
    
    protected function getHeaderActions(): array
    {
        return [
            Actions\CreateAction::make(),
        ];
    }

    protected function mutateFormDataBeforeCreate(array $data): array
    {
        $data['user_id'] = auth()->id();
    
        return $data;
    }
}


it doesn't work

Thank you
Solution
Check the same docs. It’s mentioned there
Jump to solution
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

Table inside simple resource's modal
FilamentFFilament / ❓┊help
3y ago
How to edit resource properties on simple resource creation?
FilamentFFilament / ❓┊help
2y ago
How test resource flag --simple
FilamentFFilament / ❓┊help
2y ago
Using a Livewire form inside a Filament Resource (simple)
FilamentFFilament / ❓┊help
3y ago