{"id":20454194,"url":"https://github.com/mouadziani/laravel-model-trackable","last_synced_at":"2025-04-13T03:34:45.425Z","repository":{"id":44543104,"uuid":"314646287","full_name":"mouadziani/laravel-model-trackable","owner":"mouadziani","description":"🔍 Laravel package that allows you to track and log nested changes applied on your models","archived":false,"fork":false,"pushed_at":"2022-07-31T03:51:16.000Z","size":121,"stargazers_count":58,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T20:49:42.638Z","etag":null,"topics":["laravel","laravel-package","php"],"latest_commit_sha":null,"homepage":"","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/mouadziani.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-20T19:08:22.000Z","updated_at":"2024-07-20T19:23:23.000Z","dependencies_parsed_at":"2022-08-22T20:30:59.060Z","dependency_job_id":null,"html_url":"https://github.com/mouadziani/laravel-model-trackable","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mouadziani%2Flaravel-model-trackable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mouadziani%2Flaravel-model-trackable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mouadziani%2Flaravel-model-trackable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mouadziani%2Flaravel-model-trackable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mouadziani","download_url":"https://codeload.github.com/mouadziani/laravel-model-trackable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248659923,"owners_count":21141208,"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":["laravel","laravel-package","php"],"created_at":"2024-11-15T11:15:17.050Z","updated_at":"2025-04-13T03:34:45.370Z","avatar_url":"https://github.com/mouadziani.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"art/logo.jpeg\" alt=\"logo\" /\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/mouadziani/laravel-model-trackable.svg?style=flat-square)](https://packagist.org/packages/mouadziani/laravel-model-trackable)\n\nA laravel package that allows you to track and log nested changes applied on your (models, and their relations) using a **single Trait** \n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require mouadziani/laravel-model-trackable\n```\n\n## Simple Usage\n\n- Firstly you have to apply trackable trait on your model\n\n``` php\n\nuse LaravelModelTrackable\\Traits\\Trackable;\n\nclass ModelName extends Model\n{\n    use Trackable;\n\n    //\n}\n```\n\n- In case you want to track the changes applied on your model's relationships, you need to add an attribute in your model called `$toBeLoggedRelations` which must contain an array of relationships like the example below\n``` php\n\nuse LaravelModelTrackable\\Traits\\Trackable;\n\nclass ModelName extends Model\n{\n    use Trackable;\n\n    public $toBeLoggedRelations = ['relation1', 'relation2'];\n}\n```\n\n\n- Then, you can get an array that should contains all changes applied on your model after every update\n``` php\n$model = ModelName::update([\n    ...\n]);\n\n// Get list of changed attributes\n$model-\u003egetChangedAttributes();\n ``` \n\n## Disclaimer\nCurrently this package can't track hasMany, ManyToMany or MorphMany relations\n\n### Testing\n\n``` bash\ncomposer test\n```\n\n### Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n### Security\n\nIf you discover any security related issues, please email mouad.ziani1997@gmail.com instead of using the issue tracker.\n\n## Credits\n\n- [Mouad ZIANI](https://github.com/mouadziani)\n- [All Contributors](../../contributors)\n\n\n## Licence            \nThis package is [Treeware](https://treeware.earth). If you use it in production, then we ask that you [**buy the world a tree**](https://plant.treeware.earth/mouadziani/laravel-model-trackable) to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.\n\n\nfeatured_repository\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmouadziani%2Flaravel-model-trackable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmouadziani%2Flaravel-model-trackable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmouadziani%2Flaravel-model-trackable/lists"}