src/Mediable.php
protected function handleMediableDeletion()
    {
        // only cascade soft deletes when configured
        if (static::hasGlobalScope(SoftDeletingScope::class) && ! $this->forceDeleting) {
            if (config('mediable.detach_on_soft_delete')) {
                $this->media()->detach();
            }
            // always cascade for hard deletes
        } else {
            $this->media()->detach();
        }
    }
protected function handleMediableDeletion()
    {
        // only cascade soft deletes when configured
        if (static::hasGlobalScope(SoftDeletingScope::class) && ! $this->forceDeleting) {
            if (config('mediable.detach_on_soft_delete')) {
                $this->media()->detach();
            }
            // always cascade for hard deletes
        } else {
            $this->media()->detach();
        }
    }
protected function handleMediableDeletion ( ) { // only cascade soft deletes when configured if ( static :: hasGlobalScope ( SoftDeletingScope :: class ) && ! $ this -> forceDeleting ) { if ( config ( 'mediable.detach_on_soft_delete' ) ) { $ this -> media ( ) -> detach ( ) ; } // always cascade for hard deletes } else { $ this -> media ( ) -> detach ( ) ; } }
Determine whether media relationships should be detached when the model is deleted or soft deleted.
@return void
Determine whether media relationships should be detached when the model is deleted or soft deleted .