mirror of
https://github.com/koel/koel
synced 2024-12-25 12:03:06 +00:00
21 lines
507 B
PHP
21 lines
507 B
PHP
<?php
|
|
|
|
namespace App\Services\SongStorages\Concerns;
|
|
|
|
use App\Models\Song;
|
|
use Illuminate\Contracts\Filesystem\Filesystem as IlluminateFilesystem;
|
|
use League\Flysystem\Filesystem;
|
|
|
|
trait DeletesUsingFilesystem
|
|
{
|
|
private function deleteUsingFileSystem(Filesystem | IlluminateFilesystem $disk, Song $song, bool $backup): void
|
|
{
|
|
$path = $song->storage_metadata->getPath();
|
|
|
|
if ($backup) {
|
|
$disk->move($path, "backup/$path");
|
|
}
|
|
|
|
$disk->delete($path);
|
|
}
|
|
}
|