Laravel-eloquent-logs is a fantastic package that can log what happens to your Eloquent models (created|updated|deleted|soft deleted|restored|force deleted) and keep an eye on who made the change, how, and when. This solution is simple to integrate and introduces minimal changes to your project: 1 migration, 1 model, and 1 trait.

Publish the migrations: php artisan vendor:publish --tag="eloquent-logs-migrations"

Pick an Eloquent model that you want to log the changes that happen to it and add the HasLogs trait to it.

You can load a model's logs using the eloquentLogs relationship: $example->eloquentLogs; $example->load('eloquentLogs'); App\Models\Example::with('eloquentLogs')->find($id); And you can query logs directly: // latest 5 logs with affected models ElaborateCode\EloquentLogs\Models\EloquentLog::with('loggable')->latest()->limit(5)->get()
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners