PHPackages                             cesargb/laravel-cascade-delete - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. cesargb/laravel-cascade-delete

ActiveLibrary[Database &amp; ORM](/categories/database)

cesargb/laravel-cascade-delete
==============================

Cascading eliminations implemented in polymorphic relationships for the Laravel apps

1.10.0(2w ago)1956.1k↓97.9%3MITPHPPHP ^8.2CI passing

Since Aug 9Pushed 2w ago2 watchersCompare

[ Source](https://github.com/cesargb/laravel-cascade-delete)[ Packagist](https://packagist.org/packages/cesargb/laravel-cascade-delete)[ RSS](/packages/cesargb-laravel-cascade-delete/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (9)Versions (30)Used By (0)

[![tests](https://github.com/cesargb/laravel-cascade-delete/actions/workflows/tests.yml/badge.svg)](https://github.com/cesargb/laravel-cascade-delete/actions/workflows/tests.yml)[![static analysis](https://github.com/cesargb/laravel-cascade-delete/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/cesargb/laravel-cascade-delete/actions/workflows/static-analysis.yml)[![lint](https://github.com/cesargb/laravel-cascade-delete/actions/workflows/lint.yml/badge.svg)](https://github.com/cesargb/laravel-cascade-delete/actions/workflows/lint.yml)[![Quality Score](https://camo.githubusercontent.com/66d7f249081e859fe6d2f4eaa9108dfdcf15448d36e2411c47b0ee7af13bea2c/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f636573617267622f6c61726176656c2d636173636164652d64656c6574652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/cesargb/laravel-cascade-delete)[![Total Downloads](https://camo.githubusercontent.com/7bb1c1bb4c0a901a2a285b27bd9a6618d5f919a8003434ed048604f9503127e6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636573617267622f6c61726176656c2d636173636164652d64656c6574652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cesargb/laravel-cascade-delete)

Cascading eliminations implemented in polymorphic relationships for the Laravel apps
====================================================================================

[](#cascading-eliminations-implemented-in-polymorphic-relationships-for-the-laravel-apps)

This package permit add a trait for use in Elocuents Models that deletes in cascade the Polymorphic Relations (`MorphOne`, `MorphMany` or `MorphToMany`).

Installation
------------

[](#installation)

This package can be used in Laravel 5.5 or higher.

You can install the package via composer:

```
composer require cesargb/laravel-cascade-delete
```

Use
---

[](#use)

Use the trait `Cesargb\Database\Support\CascadeDelete` in your Elocuent Model and define de property `cascadeDeleteMorph` whith one String or Array with your methods than define the Polymorphic Relations.

Code Sample
-----------

[](#code-sample)

```
