robmellett / laravel-model-history
A simple trait to add to your models so you can store CREATED and UPDATED differences
Requires
- php: ^8.2
- illuminate/contracts: ^9.0|^10.0|^11.0
- spatie/laravel-package-tools: ^1.9.2
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^6.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2024-10-31 00:18:14 UTC
README
Track model history
This little package will create a history_events
table, so that you can track model Created and Updated events, along with the data changing between updates.
Installation
You can install the package via composer:
composer require robmellett/laravel-model-history
You can publish and run the migrations with:
php artisan vendor:publish --tag="model-history-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="model-history-config"
This is the contents of the published config file:
return [
];
Usage
You can add the Historize
trait to your model, and the CREATED and UPDATED events will be fired when the model is created and updated.
class Product extends Model { use Historize; }
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.