https://github.com/skore/laravel-auditable
Audit the users that performs actions to your application models
https://github.com/skore/laravel-auditable
audits eloquent-models laravel laravel-migrations laravel-package traits
Last synced: 6 months ago
JSON representation
Audit the users that performs actions to your application models
- Host: GitHub
- URL: https://github.com/skore/laravel-auditable
- Owner: skore
- License: mit
- Created: 2020-03-10T18:55:26.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-03-11T14:53:10.000Z (over 1 year ago)
- Last Synced: 2025-12-26T09:37:51.366Z (7 months ago)
- Topics: audits, eloquent-models, laravel, laravel-migrations, laravel-package, traits
- Language: PHP
- Homepage:
- Size: 66.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# Laravel Auditable
Audit the users that performs actions to your application models
## Status
[](https://packagist.org/packages/skore-labs/laravel-auditable) [](https://github.com/skore/laravel-auditable/actions/workflows/tests.yml) [](https://github.styleci.io/repos/246383106) [](https://www.codacy.com/gh/skore/laravel-auditable?utm_source=github.com&utm_medium=referral&utm_content=skore/laravel-auditable&utm_campaign=Badge_Grade) [](https://www.codacy.com/gh/skore/laravel-auditable/dashboard?utm_source=github.com&utm_medium=referral&utm_content=skore/laravel-auditable&utm_campaign=Badge_Coverage) [](https://github.com/skore/laravel-auditable) [](https://github.com/skore/laravel-auditable)
## Getting started
```
composer require skore-labs/laravel-auditable
```
And write this on the models you want to have auditables:
```php
bigIncrements('id');
$table->string('title');
$table->text('content');
$table->timestamps();
$table->softDeletes();
$table->auditables();
// or if has softDeletes (deleted_at column):
$table->auditables(true);
// also you might want to rename the users table:
$table->auditables(true, 'my_users_table');
});
}
public function down()
{
Schema::dropIfExists('posts');
}
}
```
**Note: If you wanna remove it on the `down` method of your migrations, you can use `dropAuditables`.**
```php
public function down()
{
Schema::table('posts', function (Blueprint $table) {
$table->dropAuditables();
// or if has softDeletes (deleted_at column):
$table->dropAuditables(true);
});
}
```
### Methods
These are all the relationships that the `Auditable` trait provides to your model:
```php
$post = Post::first();
$post->createdBy; // Author of the post
$post->updatedBy; // Author of the last update of the post
$post->deletedBy; // Author of the deletion of the post
$post->author; // Alias for createdBy
```
## Support
This and all of our Laravel packages follows as much as possibly can the LTS support of Laravel.
Read more: https://laravel.com/docs/master/releases#support-policy
## Credits
- Ruben Robles ([@d8vjork](https://github.com/d8vjork))
- Skore ([https://www.getskore.com/](https://www.getskore.com/))
- [And all the contributors](https://github.com/skore-labs/laravel-status/graphs/contributors)