As for logging at certain times, perhaps the ability to disable logging will help - https://spatie.be/docs/laravel-activitylog/v4/advanced-usage/logging-model-events#content-disabling-logging-on-demand. And you can check where the request came from (from the web or api), as well as the time, in the middleware.
Nov 9, 2023
3
Level 2
Using spatie Laravel-activitylog to track user logs only though apis and made in specific time
I'm working on a project using Spatie Laravel-activitylog Package to keep track of user logs for different activities in the project. Currently everything is being logged correctly. I would track different events including update, create, delete in different models within a specific time and only events through the api, i'm thinking of using a middleware but i'm stuck pn how to approach it. Kindly assist if you can
Please or to participate in this conversation.