Activity Log

Closed
Vanguard - Advanced PHP Login and User Management Vanguard - Advanced PHP Login and User Management July 08, 2018
Login to reply
Milos Stojanovic Support Agent
6 days ago
Closed due to inactivity.
Milos Stojanovic Support Agent
1 week ago

Hey Joshua,

There is no official tutorial on how to do that, but I will add it soon for sure.

In general, you will need to either fire an event and then create a listener or subscriber which will listen for that event and then log the message. Check "app/Listeners/UserEventsSubscriber.php" file to see it in action.

Now, if you don't want to follow that approach, you can simply use the code below anywhere in your controller to log a specific action:

app(\Vanguard\Services\Logging\UserActivity\Logger::class)->log('Your custom log message here');

This will automatically write the log message you provide into the activity log for currently authenticated user.

- Milos

Joshua Blevins
1 week ago

Is there a tutorial on how to add other tables to the activity log.

For example I have another table called companies. Is there a way to add when someone edits a company or adds a new company to add it into the activity log