src/MediaUploader.php
private function generateUniqueFilename(Media $model)
    {
        $storage = $this->filesystem->disk($model->disk);
        $counter = 0;
        do {
            $filename = "{$model->filename}";
            if ($counter > 0) {
                $filename .= '-' . $counter;
            }
            $path = "{$model->directory}/{$filename}.{$model->extension}";
            ++$counter;
        } while ($storage->has($path));

        return $filename;
    }
private function generateUniqueFilename(Media $model)
    {
        $storage = $this->filesystem->disk($model->disk);
        $counter = 0;
        do {
            $filename = "{$model->filename}";
            if ($counter > 0) {
                $filename .= '-' . $counter;
            }
            $path = "{$model->directory}/{$filename}.{$model->extension}";
            ++$counter;
        } while ($storage->has($path));

        return $filename;
    }
private function generateUniqueFilename ( Media $ model ) { $ storage = $ this -> filesystem -> disk ( $ model -> disk ) ; $ counter = 0 ; do { $ filename = "{$model->filename}" ; if ( $ counter > 0 ) { $ filename .= '-' . $ counter ; } $ path = "{$model->directory}/{$filename}.{$model->extension}" ; ++ $ counter ; } while ( $ storage -> has ( $ path ) ) ; return $ filename ; }
Increment model's filename until one is found that doesn't already exist.
@param  \Plank\Mediable\Media $model
@return string
Increment model s filename until one is found that doesn t already exist .