protected function handleMediaDeletion()
{
// optionally detach mediable relationships on soft delete
if (static::hasGlobalScope(SoftDeletingScope::class) && !$this->forceDeleting) {
if (config('mediable.detach_on_soft_delete')) {
$this->newBaseQueryBuilder()->from('mediables')->where('media_id', $this->getKey())->delete();
}
// unlink associated file on delete
} else {
$this->storage()->delete($this->getDiskPath());
}
}