I would like to rename a collection of uploaded files, but when I use addAllMediaFromRequest()
I can't retrieve information from the files.
In this example; I need to know the file extension in order to rename the file.
$files = $post->addAllMediaFromRequest();
$files->each(function (FileAdder $file) {
$file->usingFileName(Str::random(16) . '.jpg') // What if it's a png?
->toMediaCollection();
});