koel/app/Observers/AlbumObserver.php

24 lines
354 B
PHP
Raw Normal View History

2018-08-29 07:58:46 +00:00
<?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);
}
}
}