Download the PHP package it-devgroup/laravel-model-change-log without Composer
On this page you can find all versions of the php package it-devgroup/laravel-model-change-log. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download it-devgroup/laravel-model-change-log
More information about it-devgroup/laravel-model-change-log
Files in it-devgroup/laravel-model-change-log
Package laravel-model-change-log
Short Description laravel model change log
License MIT
Informations about the package laravel-model-change-log
Description
- customizable automatic logging of any eloquent models
- rollback or apply any past changes through history
- it is possible to disable logging for a separate piece of code
- it is possible to enable or disable individual module events for a separate piece of code
- command to clean up old entries, can be applied in cron
Install for laravel
1. Open file config/app.php and search
Add to section
Example
Attention! It is recommended to connect the service provider in the list last
2. Run commands
For creating config file
For creating migration file
For generate table
3. Open config file config/model_change_log.php
and customize
Command for clear old entries
or run in laravel scheduler in the file app/Console/Kernel.php
Usage
Enable/Disable module for current script
Enable/Disable event for current script
Events:
- \ItDevgroup\ModelChangeLog\Models\ModelChangeLog::TYPE_EVENT_CREATE
- \ItDevgroup\ModelChangeLog\Models\ModelChangeLog::TYPE_EVENT_UPDATE
- \ItDevgroup\ModelChangeLog\Models\ModelChangeLog::TYPE_EVENT_DELETE
- \ItDevgroup\ModelChangeLog\Models\ModelChangeLog::TYPE_EVENT_SOFT_DELETE
- \ItDevgroup\ModelChangeLog\Models\ModelChangeLog::TYPE_EVENT_FORCE_DELETE
Apply changes from history
$fields
- List of fields to be applied, if not specified, all fields from the history will be applied
Rollback changes from history
$fields
- List of fields to be applied, if not specified, all fields from the history will be applied
Optional modification custom model
Get entries from history for current model
If you add trait \ItDevgroup\ModelChangeLog\Traits\ModelChangeLogTrait
to your eloquent model, then the history of this model will be available by relationship
Not logged fields for current model
Default Field Value for Restoring a Model
Fields that will be filled with default values (when the model is restored), recommended for required model fields in case these fields are not in the history
All other work with the history is done through the eloquent model \ItDevgroup\ModelChangeLog\Models\ModelChangeLog
All versions of laravel-model-change-log with dependencies
illuminate/support Version ^8.0|^9.0
illuminate/database Version ^8.0|^9.0
nesbot/carbon Version ^1.0|^2.0