{"id":16264833,"url":"https://github.com/yajra/laravel-auditable","last_synced_at":"2025-04-04T12:09:12.712Z","repository":{"id":3728973,"uuid":"50564001","full_name":"yajra/laravel-auditable","owner":"yajra","description":"Basic Auditable package for Eloquent Model.","archived":false,"fork":false,"pushed_at":"2024-03-25T06:09:01.000Z","size":91,"stargazers_count":157,"open_issues_count":1,"forks_count":23,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-17T19:24:49.827Z","etag":null,"topics":["audit-log","eloquent","hacktoberfest","laravel","php"],"latest_commit_sha":null,"homepage":"http://yajrabox.com/docs/laravel-auditable","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/yajra.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","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},"funding":{"patreon":"yajra","custom":"https://www.paypal.me/yajra"}},"created_at":"2016-01-28T07:14:34.000Z","updated_at":"2024-09-27T08:47:48.000Z","dependencies_parsed_at":"2024-06-18T15:18:17.667Z","dependency_job_id":"933dd3a3-8084-4de7-944c-96d65e187002","html_url":"https://github.com/yajra/laravel-auditable","commit_stats":{"total_commits":89,"total_committers":13,"mean_commits":6.846153846153846,"dds":0.2247191011235955,"last_synced_commit":"bf1434c4e96eb6869d684ab4fc7a0e235f82a209"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yajra%2Flaravel-auditable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yajra%2Flaravel-auditable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yajra%2Flaravel-auditable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yajra%2Flaravel-auditable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yajra","download_url":"https://codeload.github.com/yajra/laravel-auditable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247174427,"owners_count":20896078,"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","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":["audit-log","eloquent","hacktoberfest","laravel","php"],"created_at":"2024-10-10T17:03:43.182Z","updated_at":"2025-04-04T12:09:12.692Z","avatar_url":"https://github.com/yajra.png","language":"PHP","funding_links":["https://patreon.com/yajra","https://www.paypal.me/yajra"],"categories":[],"sub_categories":[],"readme":"# Laravel Auditable\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE.md)\n\n[![Continuous Integration](https://github.com/yajra/laravel-auditable/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/yajra/laravel-auditable/actions/workflows/continuous-integration.yml)\n[![Static Analysis](https://github.com/yajra/laravel-auditable/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/yajra/laravel-auditable/actions/workflows/static-analysis.yml)\n[![Total Downloads][ico-downloads]][link-downloads]\n\nLaravel Auditable is a simple Laravel auditing package for your Eloquent Model.\nThis package automatically inserts/updates an audit log on your table on who created and last updated the record.\n\n## Laravel Version Compatibility\n\n| Laravel  | Package |\n|:---------|:--------|\n| 5.x-10.x | 4.x     |\n| 11.x     | 11.x    |\n| 12.x     | 12.x    |\n\n## Install via Composer\n\n```bash\ncomposer require yajra/laravel-auditable:^12\n```\n\n## Publish config file\n\nIf you want to modify the `withDefault` option on auditable columns, you may publish the config file.\n\n```bash\nphp artisan vendor:publish --tag=auditable\n```\n\n## Usage\n\nUpdate your model's migration and add `created_by` and `updated_by` field using the `auditable()` blueprint macro.\n\n```php\nSchema::create('users', function (Blueprint $table) {\n    $table-\u003eincrements('id');\n    $table-\u003estring('name', 100);\n    $table-\u003eauditable();\n    $table-\u003etimestamps();\n});\n```\n\nThen use `AuditableTrait` on your model.\n\n``` php\nnamespace App;\n\nuse Yajra\\Auditable\\AuditableTrait;\n\nclass User extends Model\n{\n    use AuditableTrait;\n}\n```\n\n## Soft Deletes\n\nIf you wish to use Laravel's soft deletes, use the `auditableWithDeletes()` method on your migration instead:\n\n```php\nSchema::create('users', function (Blueprint $table) {\n    $table-\u003eincrements('id');\n    $table-\u003estring('name', 100);\n    $table-\u003eauditableWithDeletes();\n    $table-\u003etimestamps();\n    $table-\u003esoftDeletes()\n});\n```\n\nAfterwards, you need to use `AuditableWithDeletesTrait` on your model.\n\n``` php\nnamespace App;\n\nuse Yajra\\Auditable\\AuditableWithDeletesTrait;\n\nclass User extends Model\n{\n    use AuditableWithDeletesTrait, SoftDeletes;\n}\n```\n\n\n## Dropping columns\n\nYou can drop auditable columns using `dropAuditable()` method, or `dropAuditableWithDeletes()` if using soft deletes.\n\n```php\nSchema::create('users', function (Blueprint $table) {\n    $table-\u003edropAuditable();\n});\n```\n\nAnd you're done! The package will now automatically add a basic audit log for your model to track who inserted and last updated your records.\n\n## Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Testing\n\n``` bash\ncomposer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email aqangeles@gmail.com instead of using the issue tracker.\n\n## Credits\n\n- [Arjay Angeles][link-author]\n- [All Contributors][link-contributors]\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/yajra/laravel-auditable.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-travis]: https://img.shields.io/travis/yajra/laravel-auditable/master.svg?style=flat-square\n[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/yajra/laravel-auditable.svg?style=flat-square\n[ico-code-quality]: https://img.shields.io/scrutinizer/g/yajra/laravel-auditable.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/yajra/laravel-auditable.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/yajra/laravel-auditable\n[link-travis]: https://travis-ci.org/yajra/laravel-auditable\n[link-downloads]: https://packagist.org/packages/yajra/laravel-auditable\n[link-author]: https://github.com/yajra\n[link-contributors]: ../../contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyajra%2Flaravel-auditable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyajra%2Flaravel-auditable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyajra%2Flaravel-auditable/lists"}