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
3 Replies
Solution
Dennis Koch
Dennis Koch2mo ago
Check the same docs. It’s mentioned there
Dennis Koch
Dennis Koch2mo ago
There is a similar method on the CreateAction
thyk123
thyk1232mo ago
Thank you!