{"id":19706721,"url":"https://github.com/unisharp/laravel-audit-trail","last_synced_at":"2025-04-29T16:33:39.135Z","repository":{"id":57075551,"uuid":"45382954","full_name":"UniSharp/laravel-audit-trail","owner":"UniSharp","description":null,"archived":false,"fork":false,"pushed_at":"2018-03-26T08:12:41.000Z","size":17,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-05T18:12:30.567Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UniSharp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-02T08:56:14.000Z","updated_at":"2018-03-26T08:12:42.000Z","dependencies_parsed_at":"2022-08-24T14:40:30.844Z","dependency_job_id":null,"html_url":"https://github.com/UniSharp/laravel-audit-trail","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UniSharp%2Flaravel-audit-trail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UniSharp%2Flaravel-audit-trail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UniSharp%2Flaravel-audit-trail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UniSharp%2Flaravel-audit-trail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UniSharp","download_url":"https://codeload.github.com/UniSharp/laravel-audit-trail/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251540544,"owners_count":21605927,"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":[],"created_at":"2024-11-11T21:36:41.105Z","updated_at":"2025-04-29T16:33:34.120Z","avatar_url":"https://github.com/UniSharp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Laravel Audit Trail\n===================\n\n### What is this package for? ###\n\n* This package is for laravel 5.0/5.1, which helps you create your auditing logs into your database. \n\n## Setup\n\n1. In `/config/app.php`, add the following to `providers`:\n\n    ```\n    Unisharp\\AuditTrail\\AuditServiceProvider::class,\n    ```\n\n    and the following to `aliases`:\n\n    ```\n    'Audit' =\u003e Unisharp\\AuditTrail\\Facades\\Audit::class,\n    ```\n2. Run `php artisan vendor:publish`.\n3. Run `php artisan migrate`.\n\n## Usage\n\n\u003e All your logs will be recorded in 'audit_trails' table. \n\n* You need to add a trait to the model you're going to audit.\n    \n    ```php\n    class User extends Eloquent\n    {\n      use \\Unisharp\\AuditTrail\\Auditable;\n\n      protected $table = 'users';\n\n      protected $hidden = ['password'];\n\n      protected $fillable = ['username', 'email', 'password'];\n    }\n    ```\n\n* In any place you want to audit your user logs\n\n   ```php\n   $User-\u003elog($action, $comment = null, $subject = null, $subject_id = null)\n   ```\n\n   ```php\n   Audit::log($action, $comment = null)\n   ```\n\n   ```php\n   $User-\u003elog('log in', 'the action is approved')\n   ```\n\n   ```php\n   Audit::log('log in', 'the action is approved')\n   ```\n\n    * $User is an Eloquent Object here.\n    * The second, third parameters are optional.\n    * You could put your modified column and column id to `subject` and `subject_id` parameters.\n\n* Other usages\n\n  * You can get your model logs by:\n\n       ```php\n       $User-\u003egetLogs();\n       ```\n  * Get all the logs by single user by using:\n\n       ```php\n       Audit::getByUserId($user_id)\n       ```\n  * As time grows, logs would be outdated. You may clean them by:\n\n       ```php\n       $User-\u003ecleanLogs()\n       ```\n## License\n\nThis package is licensed under [MIT license](https://unisharp.mit-license.org/).\n       \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funisharp%2Flaravel-audit-trail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funisharp%2Flaravel-audit-trail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funisharp%2Flaravel-audit-trail/lists"}