{"id":16078466,"url":"https://github.com/romanzipp/laravel-previously-deleted","last_synced_at":"2025-08-01T14:02:30.509Z","repository":{"id":32969042,"uuid":"148143847","full_name":"romanzipp/Laravel-Previously-Deleted","owner":"romanzipp","description":"Store selected attributes of Models before deletion","archived":false,"fork":false,"pushed_at":"2025-03-20T07:46:18.000Z","size":56,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-15T14:15:05.717Z","etag":null,"topics":["gdpr","laravel","php","php7","privacy","showcase"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/romanzipp/laravel-previously-deleted","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/romanzipp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","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},"funding":{"github":"romanzipp"}},"created_at":"2018-09-10T11:17:42.000Z","updated_at":"2025-03-20T07:46:17.000Z","dependencies_parsed_at":"2025-06-16T06:01:16.801Z","dependency_job_id":null,"html_url":"https://github.com/romanzipp/Laravel-Previously-Deleted","commit_stats":{"total_commits":67,"total_committers":2,"mean_commits":33.5,"dds":0.04477611940298509,"last_synced_commit":"7d29d0df9d47611c30ee1d791ca8557cea228d0c"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/romanzipp/Laravel-Previously-Deleted","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romanzipp%2FLaravel-Previously-Deleted","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romanzipp%2FLaravel-Previously-Deleted/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romanzipp%2FLaravel-Previously-Deleted/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romanzipp%2FLaravel-Previously-Deleted/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/romanzipp","download_url":"https://codeload.github.com/romanzipp/Laravel-Previously-Deleted/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romanzipp%2FLaravel-Previously-Deleted/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268240279,"owners_count":24218355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"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":["gdpr","laravel","php","php7","privacy","showcase"],"created_at":"2024-10-09T10:12:58.355Z","updated_at":"2025-08-01T14:02:30.426Z","avatar_url":"https://github.com/romanzipp.png","language":"PHP","funding_links":["https://github.com/sponsors/romanzipp"],"categories":[],"sub_categories":[],"readme":"# Laravel Previously Deleted\n\n[![Latest Stable Version](https://img.shields.io/packagist/v/romanzipp/laravel-previously-deleted.svg?style=flat-square)](https://packagist.org/packages/romanzipp/laravel-previously-deleted)\n[![Total Downloads](https://img.shields.io/packagist/dt/romanzipp/laravel-previously-deleted.svg?style=flat-square)](https://packagist.org/packages/romanzipp/laravel-previously-deleted)\n[![License](https://img.shields.io/packagist/l/romanzipp/laravel-previously-deleted.svg?style=flat-square)](https://packagist.org/packages/romanzipp/laravel-previously-deleted)\n[![GitHub Build Status](https://img.shields.io/github/actions/workflow/status/romanzipp/Laravel-Previously-Deleted/tests.yml?branch=master\u0026label=tests\u0026style=flat-square)](https://github.com/romanzipp/Laravel-Previously-Deleted/actions)\n\nThis package stores selected attributes of Models before deletion.\n\n## Why?\n\nIf a user requests a deletion of their user data, you are partially required to remove all data related to the user (GDPR).\nWith this package, you can store certain attributes \u0026 values e.g. to block previously registered usernames oder email addresses.\n\n## Installation\n\n```\ncomposer require romanzipp/laravel-previously-deleted\n```\n\n**If you use Laravel 5.5+ you are already done, otherwise continue:**\n\n```php\nromanzipp\\PreviouslyDeleted\\Providers\\PreviouslyDeletedProvider::class,\n```\n\nAdd Service Provider to your app.php configuration file:\n\n## Configuration\n\nCopy configuration to config folder:\n\n```\n$ php artisan vendor:publish --provider=\"romanzipp\\PreviouslyDeleted\\Providers\\PreviouslyDeletedProvider\"\n```\n\nRun the migration:\n\n```\n$ php artisan migrate\n```\n\n## Usage\n\nThis example shows the usage with a User model and stored \"username\" and \"email\" attributes.\n\n### Add Model Trait\n\n```php\nuse romanzipp\\PreviouslyDeleted\\Traits\\SavePreviouslyDeleted;\n\nclass User extends Model\n{\n    use SavePreviouslyDeleted;\n\n    protected $storeDeleted = [\n        'username',\n        'email',\n    ];\n}\n```\n\n### Add Validation Rule\n\nThe validation rule takes 2 arguments: `not_deleted:{table}[,{attribute}]`\n\n- `table`: The queried table name. In this exmaple: `users`.\n- `attribute`: The model attribute. If not given, the input name will be used.\n\n```php\npublic function store(Request $request)\n{\n    $request-\u003evalidate([\n        'name' =\u003e ['required', 'not_deleted:users,username'],\n        'email' =\u003e ['required', 'not_deleted:users'],\n        'password' =\u003e ['required', 'min:6']\n    ]);\n\n    User::create([\n        'username' =\u003e $request-\u003einput('name'),\n        'email' =\u003e $request-\u003einput('email'),\n        'password' =\u003e bcrypt($request-\u003einput('password')),\n    ]);\n}\n```\n\nYou can also use a rule instance:\n\n```php\nuse romanzipp\\PreviouslyDeleted\\Rules\\NotPreviouslyDeleted;\n\n$request-\u003evalidate([\n    'name' =\u003e ['required', new NotPreviouslyDeleted(User::class, 'username')],\n    'email' =\u003e ['required', new NotPreviouslyDeleted(User::class)],\n    'password' =\u003e ['required', 'min:6']\n]);\n```\n\n## Extended Usage\n\n### Storing hashed values\n\nWhen storing personal information you should create hashes to respect your users privacy.\n\n**Store plain-text values**\n\n```php\nprotected $storeDeleted = [\n    'username',\n    'email',\n];\n```\n\nWith the GDPR (DSGVO) a user has the right to request a full deletion of all personal information, including email address, username etc.\nIf you're affected by this, you should make use of hashing algorythms to prevent any harm of privacy.\n\n**Store hashed values**\n\n```php\nprotected $storeDeleted = [\n    'username' =\u003e 'sha1',\n    'email' =\u003e 'md5',\n];\n```\n\n### Storing soft deletes\n\nBy default, the package only stores attributes if the model is being force-deleted.\n\nTo enable storing attributes even in soft-deletion, set the `ignore_soft_deleted` config value to `false`.\n\n```php\nreturn [\n    'ignore_soft_deleted' =\u003e false,\n];\n```\n\n## Testing\n\n```shell\n./vendor/bin/phpunit\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromanzipp%2Flaravel-previously-deleted","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fromanzipp%2Flaravel-previously-deleted","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromanzipp%2Flaravel-previously-deleted/lists"}