{"id":20289942,"url":"https://github.com/labrodev/laravel-trackable","last_synced_at":"2026-01-31T12:31:57.877Z","repository":{"id":262129844,"uuid":"886189125","full_name":"labrodev/laravel-trackable","owner":"labrodev","description":"The ModelHasActorTracker trait provides automatic tracking of the user who creates or updates a model record by setting created_by and updated_by attributes. This trait is useful in applications that require auditing changes and maintaining a record of the users responsible for creating and updating model instances.","archived":false,"fork":false,"pushed_at":"2024-11-23T16:14:11.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-22T17:54:47.718Z","etag":null,"topics":["eloquent-models","laravel","laravel-auth","laravel-framework","laravel-package","php","trait"],"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/labrodev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-11-10T12:46:24.000Z","updated_at":"2024-11-23T16:14:14.000Z","dependencies_parsed_at":"2024-11-10T18:31:46.635Z","dependency_job_id":"4fb3b38f-dc27-478f-81f5-0c3b2f57bcfb","html_url":"https://github.com/labrodev/laravel-trackable","commit_stats":null,"previous_names":["labrodev/laravel-trackable"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/labrodev/laravel-trackable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labrodev%2Flaravel-trackable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labrodev%2Flaravel-trackable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labrodev%2Flaravel-trackable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labrodev%2Flaravel-trackable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/labrodev","download_url":"https://codeload.github.com/labrodev/laravel-trackable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labrodev%2Flaravel-trackable/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28942935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T12:10:04.904Z","status":"ssl_error","status_checked_at":"2026-01-31T12:09:58.894Z","response_time":128,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["eloquent-models","laravel","laravel-auth","laravel-framework","laravel-package","php","trait"],"created_at":"2024-11-14T15:05:36.930Z","updated_at":"2026-01-31T12:31:57.859Z","avatar_url":"https://github.com/labrodev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Trackable for Laravel\n\nThe ModelHasActorTracker trait provides automatic tracking of the user who creates or updates a model record by setting created_by and updated_by attributes. This trait is useful in applications that require auditing changes and maintaining a record of the users responsible for creating and updating model instances.\n## Installation\n\nTo install the package, run the following command in your Laravel project:\n\n```bash\ncomposer require labrodev/laravel-trackable\n```\n\n## Requirements\n\n- PHP 8.1 or higher\n\n## Configuration\n\nAfter installing the package, no additional configuration is needed to start using the UUID trait in your models.\n\n## Usage\n\nTo use the `ModelHasActorTracker` trait, simply include it in your Eloquent model:\n\n```php \n\n\u003c?php\n\nnamespace App\\Models;\n\nuse Illuminate\\Database\\Eloquent\\Model;\nuse Labrodev\\Trackable\\ModelHasActorTracker;\n\nclass ExampleModel extends Model\n{\n    use ModelHasActorTracker;\n}\n```\n\nEnsure that your model has 'updated_by', 'created_by' columns in model database table. \n\nIf it is not, you may add it through Laravel migration: \n\n```php\n$table-\u003estring('created_by');\n$table-\u003estring('updated_by')\n```\n\n## Override column names\n\nIf the columns in your database table designated for tracking user actions through model has a names different from the default, you can customize the trait to accommodate this. \n\nSimply override the trait method in your model by adding the following methods with your specific column names:\n\n```php \n /**\n * Column to track the actor for creation.\n *\n * @return string\n */\nprotected function modelHasActorTrackerCreatedByColumn(): string\n{\n   return 'created_by'; // put your column name instead\n}\n```\n\n```php \n /**\n * Column to track the actor for updates\n *\n * @return string\n */\nprotected function modelHasActorTrackerUpdatedByColumn(): string\n{\n   return 'updated_by'; // put your column name instead\n}\n```\n\n## Overwrite logic of actor identifier\n\nYou may overwrite logic of actor identifier which making actions through model by override the trait method:\n\n```php \n/**\n* @return mixed\n*/\nprotected function modelHasActorTrackerIdentifier(): mixed\n{\n    // Put your own logic\n}\n```\n\n## Testing\n\nTo run the tests included with the package, execute the following command:\n\n```bash\ncomposer test\n```\n\nFor static analysis to check the package code, execute the followin command: \n\n```bash\ncomposer analyse\n```\n\n## Security\n\nIf you discover any security-related issues, please email admin@labrodev.com instead of using the issue tracker.\n\n## Credits\n\nLabro Dev\n\n## License\n\nThe MIT License (MIT). Please see License File for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabrodev%2Flaravel-trackable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flabrodev%2Flaravel-trackable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabrodev%2Flaravel-trackable/lists"}