Fileupload with default value
Hey I just wondering if there a work around for Fileupload to have default value base on param that pass via the url ?
3 Replies
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
or if you want to apply globally, you can use laravel observer instead, works on model level
https://laravel.com/docs/11.x/eloquent#observers
thank you I'll check it and give feedback.