ebess / advanced-nova-media-library

A Laravel Nova field for displaying, creating, updating and ordering a Spatie Media Library model.
596 stars 297 forks source link

Display files in nova using their names instead of filenames #449

Open Ringhoo opened 2 weeks ago

Ringhoo commented 2 weeks ago

Hi, I have the following field in laravel nova resource:

Files::make(__('Files'), 'downloadable')
  ->setFileName(function ($originalFilename, $extension, $model) {
      return Str::slug($model->name) . '-' . md5($originalFilename) . '.' . $extension;
  })
  ->singleMediaRules(['max:'.$maxfilesize]),

It is working fine, however the field is displaying all files using their filename, which I just modified to a md5 hash, as shown on the image below.

Screenshot 2024-11-01 at 14 37 47

It is not very friendly for a user. So my question is, is it possible to display the files using their name instead of the filename?