2024-02-04 20:31:01 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Services\SongStorage;
|
|
|
|
|
2024-02-05 13:27:17 +00:00
|
|
|
use App\Exceptions\KoelPlusRequiredException;
|
2024-02-04 20:31:01 +00:00
|
|
|
use App\Models\Song;
|
|
|
|
use App\Models\User;
|
|
|
|
use Illuminate\Http\UploadedFile;
|
|
|
|
|
2024-02-05 13:27:17 +00:00
|
|
|
abstract class SongStorage
|
2024-02-04 20:31:01 +00:00
|
|
|
{
|
2024-02-05 13:27:17 +00:00
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
throw_unless(
|
|
|
|
$this->supported(),
|
|
|
|
new KoelPlusRequiredException('The storage driver is only supported in Koel Plus.')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract public function storeUploadedFile(UploadedFile $file, User $uploader): Song;
|
2024-02-23 16:03:54 +00:00
|
|
|
|
|
|
|
abstract public function delete(Song $song, bool $backup = false): void;
|
|
|
|
|
|
|
|
abstract protected function supported(): bool;
|
2024-02-04 20:31:01 +00:00
|
|
|
}
|