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
[NEW] Practical Laravel Security: Packages, Secrets, Supply-Chain Attacks
7 lessons
43 min read
Laravel 13 Eloquent: Expert Level
41 lessons
1 h 34 min
How to Structure Laravel 13 Projects
16 lessons
1 h 32 min read