How to track every user database interaction in laravel 5?

Viewed 1712

If any logged in user accesses any service then I want to track all queries run by this user.

Example:

If user1 logs in and wants to delete his profile details and user2 wants to update his profile details, then I want to get the data in table like below

user  |   user_id  |   service     |   query  
user1 |     1      | deleteProfile |   "DELETE FROM Users WHERE id=1"
user2 |     2      | updateProfile |   "UPDATE Users SET lastname='Thaper' WHERE id=2"

For doing so I have tried to use activity log like antonioribeiro/tracker and laravel-activitylog etc. but it did not match my requirements.

How can I do this in Laravel 5.2?

1 Answers
Related