The \Imahmood\FileStorage\FileStorage
class offers several methods:
// Specify the disk where the file will be stored.
$this->fileStorage->onDisk($disk);
$this->fileStorage
->onDisk($disk)
->create($type, $relatedTo, $uploadedFile);
// Create and associate a new file.
$this->fileStorage->create($type, $relatedTo, $uploadedFile);
// Update the existing file.
$this->fileStorage->update($type, $relatedTo, $media, $uploadedFile);
// Create a new file or update an existing one.
$this->fileStorage->updateOrCreate($type, $relatedTo, $media, $uploadedFile);
// Remove the media instance from both the database and the disk.
$this->fileStorage->delete($media);