PoloKokta
PoloKokta
FFilament
Created by PoloKokta on 10/6/2023 in #❓┊help
Fill all fields in Group::make([....]) by an array
Hi, is there a way to fill all fields in group: Group::make([ RichEditor::make('title'), RichEditor::make('description') ]) with with a data from an array: $data = ['title'=>'ABC', 'description'=>'XYZ']; ?? I've tried to use afterStateHydrated and formatStateUsing on Group but all data in form, even outside of Group are then overwritten by this array. Thanks
3 replies
FFilament
Created by PoloKokta on 10/1/2023 in #❓┊help
Custom URL and file path on FIleUpload
Hi, I have basic FileUpload component for handling image uploads:
FileUpload::make('featured_image')
->disk('images')
->preserveFilenames()
->visibility('private')
->directory('instance_xxx')
FileUpload::make('featured_image')
->disk('images')
->preserveFilenames()
->visibility('private')
->directory('instance_xxx')
I want to achieve two things: 1. Now files are stored in "images" disk in /instance_xxx/ directory. Under featured_image in my database filament stores "/instance_xxx/abc.jpg" as a value. Is there a way to make it store only filename without path? I've tried to overwrite it in ->mutateDehydratedStateUsing() component, and i can do it this way but after this FIleUpload component thumbnail show there is no image (not even broken URL or something, just like there was null on "featured_image") 2. How to change URL of image that is displyed as FIleUpload thumbnail? The thing is, that my app is on multiple domains, and images are located on few subdomains, on completely different path. They are cached and converted to webp on the fly by img-proxy etc. In my app i have simple method to generating url for images, how can i apply it as FIleUpload thumbnail? Thanks
3 replies