mirror of
https://github.com/koel/koel
synced 2024-12-21 01:53:11 +00:00
22 lines
507 B
PHP
22 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);
|
||
|
}
|
||
|
}
|