mirror of
https://github.com/koel/koel
synced 2024-12-26 20:43:05 +00:00
24 lines
354 B
PHP
24 lines
354 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Observers;
|
||
|
|
||
|
use App\Models\Album;
|
||
|
use Exception;
|
||
|
use Log;
|
||
|
|
||
|
class AlbumObserver
|
||
|
{
|
||
|
public function deleted(Album $album): void
|
||
|
{
|
||
|
if (!$album->has_cover) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
try {
|
||
|
unlink($album->cover_path);
|
||
|
} catch (Exception $e) {
|
||
|
Log::error($e);
|
||
|
}
|
||
|
}
|
||
|
}
|