Skip to content

cascading deletes are not supported in Eloquent of Laravel 4 #357

@hansmbakker

Description

@hansmbakker

Eloquent items can be deleted by calling item->delete();

However, items can have relationships. For one-to-many relationships, the children of a parent object belong to that parent object and might be useless without it.

Therefore it would be convenient if those children would be automatically deleted in a cascading (recursive) way.

The delete() method in Model.php could be changed so that it looks at the hasMany relations of the current object first, calls ->delete($deleteChildren=true) on each of them and after that deletes itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions