PHPackages                             betalabs/laravel5-soft-cascade - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. betalabs/laravel5-soft-cascade

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

betalabs/laravel5-soft-cascade
==============================

Soft Delete &amp; Restore Cascader

2.0.1(9y ago)019.2k—8.3%PHPPHP &gt;=5.5.9

Since May 2Pushed 9y ago1 watchersCompare

[ Source](https://github.com/diego-betalabs/laravel5-soft-cascade)[ Packagist](https://packagist.org/packages/betalabs/laravel5-soft-cascade)[ RSS](/packages/betalabs-laravel5-soft-cascade/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (5)Versions (12)Used By (0)

[![Header](https://camo.githubusercontent.com/9532f1aa37a1b105e9c9fe9e3e5407c5b18a1f0a9a280a9ca22762eee98fcba4/68747470733a2f2f692e696d6775722e636f6d2f664b68626c6a542e706e67)](https://camo.githubusercontent.com/9532f1aa37a1b105e9c9fe9e3e5407c5b18a1f0a9a280a9ca22762eee98fcba4/68747470733a2f2f692e696d6775722e636f6d2f664b68626c6a542e706e67)

[![Build Status](https://camo.githubusercontent.com/e160ace17667e991f9265dc2e175698933269603a604d49f0241fcde82d17ff9/68747470733a2f2f7472617669732d63692e6f72672f41736b6564696f2f6c61726176656c352d736f66742d636173636164652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Askedio/laravel5-soft-cascade)[![Codacy Badge](https://camo.githubusercontent.com/90613d6c21232fb6d01b96e1a7a928017e343beb8dbc33c58e6c9193b69c1f3e/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3031396239646264373030663432623661313635373432633732653634343435)](https://www.codacy.com/app/gcphost/laravel5-soft-cascade?utm_source=github.com&utm_medium=referral&utm_content=Askedio/laravel5-soft-cascade&utm_campaign=Badge_Grade) [![StyleCI Badge](https://camo.githubusercontent.com/c5756aee014b4ca4a7f7a3fa4aa90387ee3e7c83d55f4097b88738b979662e94/68747470733a2f2f7374796c6563692e696f2f7265706f732f35373339343731302f736869656c64)](https://styleci.io/repos/57394710)

Laravel/Lumen 5 Soft Cascade Delete &amp; Restore
=================================================

[](#laravellumen-5-soft-cascade-delete--restore)

Cascade delete and restore when using the Laravel or Lumen SoftDeletes feature.

Why do I need it?
=================

[](#why-do-i-need-it)

### To make soft deleting and restoring relations easy.

[](#to-make-soft-deleting-and-restoring-relations-easy)

If you enjoy features like MySQL cascade deleting but want to use Laravels SoftDeletes feature you'll need to do some extra steps to ensure your relations are properly deleted or restored.

This package is intended to replace those steps with a simple array that defines the relations you want to cascade.

Installation
============

[](#installation)

Install with composer

```
composer require askedio/laravel5-soft-cascade

```

Register the service provider in your config/app.php

Laravel:

```
Askedio\SoftCascade\Providers\GenericServiceProvider::class,

```

Lumen:

```
Askedio\SoftCascade\Providers\LumenServiceProvider::class,

```

Usage
=====

[](#usage)

In your `Model` enable the trait and define `$softCascade`. [Example](https://github.com/Askedio/laravel5-soft-cascade/blob/master/tests/App/User.php).

```
use \Askedio\SoftCascade\Traits\SoftCascadeTrait;

protected $softCascade = ['profiles'];

```

`$softCascade` is an array of your relation names, in the [example](https://github.com/Askedio/laravel5-soft-cascade/blob/master/tests/App/User.php) you'll see we've defined `function profiles()` for the relation.

Nested relations work by defining `$softCascade` in the related `Model` as you can see [here](https://github.com/Askedio/laravel5-soft-cascade/blob/master/tests/App/Profiles.php).

After you've defined your relations you can simply trigger `delete()` or `restore()` on your `Model` and your relations will have the same task performed.

```
User::first()->delete();
User::withTrashed()->first()->restore();

```

Supported Databases
===================

[](#supported-databases)

- MySQL
- SQLite

Testing
=======

[](#testing)

I have written some very basic tests, certainly more needs to be done here. If you find this useful please help by testing other databases or writing better unit tests because I must move on.

Issues &amp; Contributing
=========================

[](#issues--contributing)

I will be using this with MySQL in a new API so any issues I find related to my use will be resolved. If you find an issue with MySQL please report it and I will fix it.

If you are using another database and have issues please contribute by submitting a pull request. I do not have time to test this with other database but assume all would work.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 86.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~35 days

Recently: every ~83 days

Total

11

Last Release

3316d ago

Major Versions

1.8 → 2.02017-04-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/5718a3a2c41de555560fde3279aaf122ce1584540c5f123e7661eaa3d79dba73?d=identicon)[diego-betalabs](/maintainers/diego-betalabs)

---

Top Contributors

[![gcphost](https://avatars.githubusercontent.com/u/1173636?v=4)](https://github.com/gcphost "gcphost (65 commits)")[![diego-betalabs](https://avatars.githubusercontent.com/u/1482834?v=4)](https://github.com/diego-betalabs "diego-betalabs (7 commits)")[![abhimanyu003](https://avatars.githubusercontent.com/u/265913?v=4)](https://github.com/abhimanyu003 "abhimanyu003 (2 commits)")[![gregoriohc](https://avatars.githubusercontent.com/u/566841?v=4)](https://github.com/gregoriohc "gregoriohc (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/betalabs-laravel5-soft-cascade/health.svg)

```
[![Health](https://phpackages.com/badges/betalabs-laravel5-soft-cascade/health.svg)](https://phpackages.com/packages/betalabs-laravel5-soft-cascade)
```

###  Alternatives

[nagy/laravel-rating

manage rating column for elqouent models

21621.1k](/packages/nagy-laravel-rating)[phpcfdi/csf-scraper

Obtiene los datos fiscales actuales de una persona moral o física dado su RFC y CIFID

216.5k](/packages/phpcfdi-csf-scraper)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
