Member-only story
Log activities in Laravel
Do you still headache how to track the user action? laravel-activitylog might can help you of this.
In sometimes we might need to do some logging in our Laravel app. Today, we gonna talk about a package who can allow us to easily making logs for every action in our app which is spatie/laravel-activitylog.
The spatie/laravel-activitylog
package provides easy to use functions to log the activities of the users of your app. It can also automatically log model events. The Package stores all activity in the activity_log
table.
In this article I will show you the installation of the package and basic usage.
Step of Installation
- Execute the command below to install the package and it will automatically register the service provider.
composer require spatie/laravel-activitylog
2. If you wish to store the activities in special database you can define the below following in your .env file:
ACTIVITY_LOGGER_DB_CONNECTION="your_special_db"
3. After the installation, you may need to clear the cache by using the command below:
php artisan config:clear