开发者

CakePHP: createdBy and updatedBy field

开发者 https://www.devze.com 2023-02-15 12:55 出处:网络
Trying to create a \'magic\' field开发者_运维百科 like the created and modified field in CakePHP, but instead of storing a timestamp, I want a username that submitted the request.

Trying to create a 'magic' field开发者_运维百科 like the created and modified field in CakePHP, but instead of storing a timestamp, I want a username that submitted the request.

Is there a way to pull in AuthComponent into the model, or do I need to do some magic with the AppController and always put a username field in the $this->data array?


This behavior is available that logs who created or modified a model record. http://bakery.cakephp.org/articles/danfreak/2009/03/01/whodidit-behavior-automagic-created_by-and-modified_by-fields

If you don't wish to use it directly, it could serve as a reference for your own work.

0

精彩评论

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