This package logs model activities inside your Laravel application.
You can install the package via composer:
composer require cybernerdie/laravel-model-activity-log
You can publish the migrations with:
php artisan vendor:publish --provider="Cybernerdie\\ModelActivityLog\\ModelActivityLogServiceProvider"
You can run the migrations with:
php artisan migrate
Add the trait to your model and also import the class:
use RecordModelActivity;
Optionally, you can set the events to be recorded for your model:
protected static $eventsToRecord = ['created', 'updated'];
Optionally, you can add columns in your model that you want to ignore when events are recorded:
protected static $columnsToIgnore = ['email'];
Retrieve activities for a model:
$user = User::find(1);
$activities = ModelActivityLog::subjectBy($user)->get();
Retrieve activities by event type:
$activities = ModelActivityLog::event('created')->get();
Retrieve changes for a specific activity:
$activities = ModelActivityLog::find(1)->changes();
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.