|
|
@ -48,8 +48,14 @@ class AvatarObserver
|
|
|
|
public function deleting(Avatar $avatar)
|
|
|
|
public function deleting(Avatar $avatar)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$path = storage_path('app/'.$avatar->media_path);
|
|
|
|
$path = storage_path('app/'.$avatar->media_path);
|
|
|
|
|
|
|
|
if(is_file($path) && $avatar->media_path != 'public/avatars/default.png') {
|
|
|
|
@unlink($path);
|
|
|
|
@unlink($path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$path = storage_path('app/'.$avatar->thumb_path);
|
|
|
|
|
|
|
|
if(is_file($path) && $avatar->thumb_path != 'public/avatars/default.png') {
|
|
|
|
|
|
|
|
@unlink($path);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Handle the avatar "restored" event.
|
|
|
|
* Handle the avatar "restored" event.
|
|
|
|