A simple laravel package to enable cascade deleting on polymorphic relations.

Overview

Morph Cascade Delete

MIT License

A simple laravel package to enable cascade deleting on polymorphic relations.

Installation

Install with composer

  composer require moataz-hajres/morph-cascade-delete

Compatibility

Tested on Laravel 8 with php 8, but it should work fine on laravel 6,7 with php ^7|^8.

Usage

1- Use the trait within models that has child morph relations.

2- Make sure to define the morphOne/morphMany relation methods as public & final.

....

class User extends Model {

    use MorphCascadeDelete;

    final public function images() {
        return $this->morphMany(Image::class, 'imageable');
    }

}

...

That's it, you're all set!

License

MIT

You might also like...
Enable user Timezones in your application.

Laravel Timezone An easy way to set a timezone for a user in your application and then show date/times to them in their local timezone. How does it wo

Jetstrap is a lightweight laravel 8 package that focuses on the VIEW side of Jetstream / Breeze package installed in your Laravel application

A Laravel 8 package to easily switch TailwindCSS resources generated by Laravel Jetstream and Breeze to Bootstrap 4.

A Laravel chat package. You can use this package to create a chat/messaging Laravel application.
A Laravel chat package. You can use this package to create a chat/messaging Laravel application.

Chat Create a Chat application for your multiple Models Table of Contents Click to expand Introduction Installation Usage Adding the ability to partic

A Laravel package that adds a simple image functionality to any Laravel model
A Laravel package that adds a simple image functionality to any Laravel model

Laraimage A Laravel package that adds a simple image functionality to any Laravel model Introduction Laraimage served four use cases when using images

Easily add a full Laravel blog (with built in admin panel and public views) to your laravel project with this simple package.

Webdevetc BlogEtc - Complete Laravel Blog Package Quickly add a blog with admin panel to your existing Laravel project. It has everything included (ro

This package provides extended support for our spatie/enum package in Laravel.
This package provides extended support for our spatie/enum package in Laravel.

Laravel support for spatie/enum This package provides extended support for our spatie/enum package in Laravel. Installation You can install the packag

Testbench Component is the de-facto package that has been designed to help you write tests for your Laravel package

Laravel Testing Helper for Packages Development Testbench Component is the de-facto package that has been designed to help you write tests for your La

🥳🔐 This package is a Laravel package that checks if an email address is a spammer
🥳🔐 This package is a Laravel package that checks if an email address is a spammer

This package is a Laravel package that checks if an email address is a spammer. It verifies your signups and form submissions to confirm that they are legitimate.

Simple user messaging package for Laravel

Laravel Messenger This package will allow you to add a full user messaging system into your Laravel application. Leave some feedback How are you using

Releases(v1.1.0)
Owner
Moataz Hajres
Web applications developer
Moataz Hajres
Rinvex Tenantable is a contextually intelligent polymorphic Laravel package, for single db multi-tenancy.

Rinvex Tenants is a contextually intelligent polymorphic Laravel package, for single db multi-tenancy. You can completely isolate tenants data with ease using the same database, with full power and control over what data to be centrally shared, and what to be tenant related and therefore isolated from others.

Rinvex 80 Oct 21, 2022
Cascade Delete & Restore when using Laravel SoftDeletes

Laravel/Lumen Soft Cascade Delete & Restore Cascade delete and restore when using the Laravel or Lumen SoftDeletes feature. Why do I need it? To make

Asked.io 669 Nov 30, 2022
Cascade delete and restore when using the Laravel or Lumen SoftDeletes feature.

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

Asked.io 669 Nov 30, 2022
A Laravel package making a diagram of your models, relations and the ability to build them with it

Laravel Schematics This package allows you to make multiple diagrams of your Eloquent models and their relations. It will help building them providing

Maarten Tolhuijs 1.4k Dec 31, 2022
A Laravel 8 and Livewire 2 demo showing how to search and filter by tags, showing article and video counts for each tag (Polymorphic relationship)

Advanced search and filter with Laravel and Livewire A demo app using Laravel 8 and Livewire 2 showing how to implement a list of articles and tags, v

Sérgio Jardim 19 Aug 29, 2022
This is an open source demo of administration panel for polymorphic relationship and SEO content

Laravel SEO admin This application demonstrates usage of polymorphic relationships described at (http://maxoffsky.com/code-blog/using-polymorphic-rela

Maksim Surguy 127 Oct 11, 2022
Automatically generate ERD Diagrams from Model's relations in Laravel

Laravel ERD Generator Automatically generate interactive ERD from Models relationships in Laravel. This package provides a CLI to automatically genera

Pulkit Kathuria 90 Dec 29, 2022
A package can enable DKIM for your Laravel mails.

TobyMaxham Laravel DKIM This package can be used to add a DKIM signature to your outgoing mails. Instead of changing the default Laravel Mailer, Larav

Tobias Maxham 2 Apr 14, 2022
Enable/disable query logger in Laravel/Lumen

Enable/disable query logger in Laravel/Lumen

Ngoc Linh Pham 5 Nov 2, 2022
Adds a service worker to Magento2 to enable PWA features

Monsoon PWA Adds icons, a web manifest file and a service-worker file to make magento 2 a PWA. Main Features Supports Magento Blank and Luma as well a

Monsoon Consulting 20 Nov 17, 2022