Reputation: 3506
I have users
table in my database lay out like this :
As of now, since I am an Admin
user so I have Admin right
, and I can Create, Update, and Delete.
I want to allow all my users to have the same right as me later on.
Before I release this feature, I want to keep track on who edit what - so things doesn't get lost, and it's good to keep the history of things.
What is best practice for this feature ?
I know that I have do some programming logic in my update function in my Controller function.
I know that I have to create a logs
table on my database to store
For someone, that had any experiences with this feature, can you PLEASE give me some advice ? I really appreciate your concern. Thank You.
Upvotes: 0
Views: 172
Reputation: 33078
I think best approach to this problem is each action that a user takes that you want to log should also fire an event.
Event::fire('some.event', array(Auth::user()));
Then you can register listeners for each event and log appropriately.
Event::listen('some.event', function($user)
{
// create new item in logs table here.
});
Upvotes: 2