{"id":50722015,"url":"https://github.com/imarc/cascade","last_synced_at":"2026-06-10T01:01:34.213Z","repository":{"id":351298713,"uuid":"1210407669","full_name":"imarc/cascade","owner":"imarc","description":"Cascading soft deletes for Laravel Eloquent models","archived":false,"fork":false,"pushed_at":"2026-04-14T12:40:53.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-14T13:30:35.986Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imarc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-14T11:42:02.000Z","updated_at":"2026-04-14T12:40:49.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/imarc/cascade","commit_stats":null,"previous_names":["imarc/cascade"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/imarc/cascade","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imarc%2Fcascade","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imarc%2Fcascade/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imarc%2Fcascade/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imarc%2Fcascade/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imarc","download_url":"https://codeload.github.com/imarc/cascade/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imarc%2Fcascade/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34132030,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-10T01:01:33.626Z","updated_at":"2026-06-10T01:01:34.197Z","avatar_url":"https://github.com/imarc.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cascade\n\nCascading soft deletes for Laravel Eloquent. When a parent model is soft-deleted, related models are soft-deleted. When the parent is restored, **all** currently trashed rows for those relations are restored one-by-one so `restored` events run (nested cascades work). This still restores every trashed child for that foreign key, not only rows deleted in the same cascade as the parent.\n\n## Usage\n\nUse Laravel’s `SoftDeletes` and this package’s `CascadeSoftDeletes` on the parent. List relationship method names to cascade:\n\n```php\nuse Illuminate\\Database\\Eloquent\\Model;\nuse Illuminate\\Database\\Eloquent\\SoftDeletes;\nuse Imarc\\Cascade\\CascadeSoftDeletes;\n\nclass Post extends Model\n{\n    use CascadeSoftDeletes, SoftDeletes;\n\n    /** @var list\u003cstring\u003e */\n    protected array $cascadeSoftDeletes = ['comments'];\n\n    public function comments(): HasMany\n    {\n        return $this-\u003ehasMany(Comment::class);\n    }\n}\n```\n\nChild models should use `SoftDeletes` if you want them included; non–soft-delete children are skipped on cascade delete.\n\n## Supported relations\n\n`HasMany`, `HasOne`, `MorphMany`, and `MorphOne` are supported. `BelongsTo`, `BelongsToMany`, and other relation types are ignored for cascading.\n\n## Force delete\n\nWhen the parent is force-deleted, soft-deletable children in the listed relations are force-deleted so orphaned soft-deleted rows are not left behind.\n\n## Install\n\n```bash\ncomposer require imarc/cascade\n```\n\n## Tests (from application root)\n\n```bash\nphp artisan test --testsuite=Cascade\n```\n\nOr:\n\n```bash\n./vendor/bin/phpunit -c packages/imarc/cascade/phpunit.xml\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimarc%2Fcascade","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimarc%2Fcascade","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimarc%2Fcascade/lists"}