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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners