Simple (modal) resource and mutateFormDataBeforeSave()

I have a problem with my simple resource.
I need to mutate the data before saving, but it's not possible to use mutateFormDataBeforeSave() as I would do with normal resource.
Any ideas?
I would like to add the following code:
  $data['user_id'] = Auth::user()->id;

I could use the boot() method on the model, but I would prefer not to do that.
Thank you
ZioLupo
Solution
Try adding ->using() to the Filament\Tables\Actions\EditAction
https://filamentphp.com/docs/3.x/actions/prebuilt-actions/edit#customizing-the-saving-process
use Illuminate\Database\Eloquent\Model;
 
EditAction::make()
    ->using(function (Model $record, array $data): Model {
        $data['user_id'] = Auth::user()->id

        $record->update($data);
   
        return $record;
    })
Was this page helpful?