Video
Premium
Description
Provides easy to use functions to log the activities of the users of your app.
Here's a demo of how you can use it:
activity()->log('Look, I logged something');
You can retrieve all activity using the Spatie\Activitylog\Models\Activity model.
Activity::all();
Here's a more advanced example:
activity() ->performedOn($anEloquentModel) ->causedBy($user) ->withProperties(['customProperty' => 'customValue']) ->log('Look, I logged something'); $lastLoggedActivity = Activity::all()->last(); $lastLoggedActivity->subject; //returns an instance of an eloquent model$lastLoggedActivity->causer; //returns an instance of your user model$lastLoggedActivity->getProperty('customProperty'); //returns 'customValue'$lastLoggedActivity->description; //returns 'Look, I logged something'
Related Content on Laravel Daily
Video
Video
Premium
Spatie Activity Log Package: Deeper Dive
Video
Recent Courses on Laravel Daily
Next.js Basics for Laravel Developers
11 lessons
58 min
Laravel 13 Starter Kit Teams and Customizations
10 lessons
33 min
Testing in Laravel 13 For Beginners
26 lessons
1 h 41 min read