spatie/laravel-activitylog

Log user and model activity in Laravel

What

Stores an activity log in the database: who did what to which model, with changed attributes. Can log automatically via a trait.

How to use

php
// composer require spatie/laravel-activitylog
// publish + run its migration, then:
activity()
    ->performedOn($article)
    ->causedBy($user)
    ->log('edited');

// or add the LogsActivity trait to a model and define getActivitylogOptions()

Reach for it when

You need an audit trail of changes in a Laravel app.