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.

Patrick Wan
Towards Dev
2 min readFeb 27, 2022

--

Photo by James Harrison on Unsplash

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

  1. Execute the command below to install the package and it will automatically register the service provider.

2. If you wish to store the activities in special database you can define the below following in your .env file:

3. After the installation, you may need to clear the cache by using the command below:

--

--

Published in Towards Dev

A publication for sharing projects, ideas, codes, and new theories.

Written by Patrick Wan

My name’s Patrick. I’m a Software Developer, experience in Laravel, Vue Js, React Js, Livewire, Jquery, Codegniter, NPM, GIT. I have 5 years plus experience.

No responses yet

Write a response