2

Hey Guys I have researched and have tested few method for logging user activity such as when an user updates his profile details or when an user updates his status in a task.

What I require to log :

  • User ID from session
  • Table being updated
  • Field Name
  • Old Value
  • New Value
  • Timestamps

Method 1: Run an additional query along with the insert/update/delete query to store details.

Method 2: Using http://packalyst.com/packages/package/regulus/activity-log

In both the above methods I have to write multiple code for each create/update/delete I would like to know if there exist a better way to handel this problem.

2 Answers 2

1

You want to store revisions of the data being manipulated by the user.

This calls for Revisionable.

Revisionable works using trait-implementation. Every action made by the user, will have the old and new value of the column stored in a seperate table. You can then query the revisionable table to get the changes made by the user.

Please note that the Revisionable version quoted above, doesn't store INSERT actions.

Sign up to request clarification or add additional context in comments.

Comments

0

A few days ago I've created such package, which, unlike VentureCraft's one, logs only static data - tables, values. No fks, no model names etc.

Also it handles the revisions in different manner, which makes it much easier to eg. compare given 2 versions, since it doesn't log single field change per row, but all the data involved per row.

Check this out: Sofa/Revisionable

This is pretty young and will be improved.

It's also not Eloquent specific, but it works out of the box with Laravel 4. You simply download it, adjust config if needed, add a few lines of code to your models and it's ready to go.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.