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:
I could use the boot() method on the model, but I would prefer not to do that.
Thank you
ZioLupo
Solution:Jump to solution
Try adding
->using()
to the Filament\Tables\Actions\EditAction
https://filamentphp.com/docs/3.x/actions/prebuilt-actions/edit#customizing-the-saving-process
```php
use Illuminate\Database\Eloquent\Model;
...2 Replies
Solution
Try adding
->using()
to the Filament\Tables\Actions\EditAction
https://filamentphp.com/docs/3.x/actions/prebuilt-actions/edit#customizing-the-saving-process
Thanks to your suggestion I was able to fine the right way.
My SimpleResource is called Task and in the 'ManageTasks.php' file I added:
The above function take care of inserting the user_id during the creation process.
Then I did the same in TaskResource taking care of the saving process:
Thank you so much!