开发者

implement user activity log in cakePHP

Which is the best method to implement user activity log in cakePHP?

I already gone through these tutorials

  1. logable behavior
  2. http://www.cakephp.co.uk/user_activity_cakephp_tutorial.html

My aim is to log these 开发者_如何转开发activities

  1. Login
  2. Logout
  3. Update Profile
  4. Change Password
  5. placing an order
  6. review order
  7. cancel order

where should i write the code for log, in App_controller or App_model or afterSave of each model.


I Guess, that using logable behaviour is a good idea (although get the newest version (see comments in the bakery)). That would be a very "convention-like" way to go.

The second link also provides a nice way to do this, a small amount of neat code (needs some refreshments though).

I think the best place to call this recordActivity function are models callback methods, here's a list of them.


I didn't use the behavior, I built my own. I put it on the afterSave (in app_model). You'll want to add a trigger to catch the login actions, though, as they don't do a save.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜