Laravel Activity Log Package

Freek Van der Herten has created a new package that will allow you to easily setup an activity log for your users. It includes two methods of logging activities, a Model trait and an Activity::log() facade.

Not only can you log events but you can pull them out using:

use Spatie\Activitylog\Models\Activity;

$latestActivities = Activity::with('user')->latest()->limit(100)->get();

Of course this wouldn’t be complete without an automatic way of cleaning up old logs:

Activity::cleanLog();

The cleanLog sounds like a perfect pairing with the Laravel 5 Scheduler