koel/app/Observers/AlbumObserver.php
2022-08-08 18:00:59 +02:00

17 lines
266 B
PHP

<?php
namespace App\Observers;
use App\Models\Album;
class AlbumObserver
{
public function deleted(Album $album): void
{
if (!$album->has_cover) {
return;
}
attempt(static fn () => unlink($album->cover_path));
}
}