Spatie Media Library custom file name

Is there a way to change the file name with an input text or a way to add some custom description?
2 Replies
Eugen Pașca
Eugen Pașca10mo ago
hey, @yaroslavpopovic , did you find a solution for this?
rajul
rajul10mo ago
This is how I did it in one of my project. ->getUploadedFileNameForStorageUsing(function (TemporaryUploadedFile $file, Get $get): string { $rec = $this->getOwnerRecord(); $name = (string) 'image-of-'. $rec->slug . '-' . Str::random(4). '.' . $file->getClientOriginalExtension(); return $name; })
Want results from more Discord servers?
Add your server