
Model Change Tracking in Laravel 11 - Laravel Auditing
If you want to keep track of your application you can achieve this by laravel auditing package. We will implement laravel audit package in laravel 11, which is laravel latest version.
Laravel Auditing package allows you to keep track of changes made to records, ensuring you can monitor and review modifications to your application's data. It offers a way to audit various events that occur on your models like ‘created’,’updated’,'deleted’,’restored’. This package is particularly useful for applications that require an audit trail for debugging, historical analysis,etc.
Installation
This package should be installed via composer.
Publishing the config file.This will create the config/audit.php configuration file
Publishing the audits table migration
Now we need to migrate
Now we need to migrate

Setting Up the Model
Make sure your Eloquent model implements AuditableContract and uses the Auditable trait.
If you go to the config/audit.php.You will this :
It means it will create the audit for these 4 events.When any of the events triggered the audit will be created.
Test the Auditing
"Eloquent events fired from a Job or from the console (i.e. migrations, tests, commands, Tinker, ...), WILL NOT be audited by default."
reference : https://laravel-auditing.com/guide/introduction.html


