#Fileupload with default value
3 messages · Page 1 of 1 (latest)
use hook instead, so if user is not providing any files, it will be handled by the hook
https://filamentphp.com/docs/3.x/panels/resources/creating-records#lifecycle-hooks
in your case it might be
Lifecycle hooks
Hooks may be used to execute code at various points within a page’s lifecycle, like before a form is saved. To set up a hook, create a protected method on the Create page class with the name of the hook:
{
// ...
}```
and for editing is
https://filamentphp.com/docs/3.x/panels/resources/editing-records#lifecycle-hooks
protected function beforeSave(): void
{
// ...
}
or if you want to apply globally, you can use laravel observer instead, works on model level