Tag Archives: model event

Laravel 4 Model Events: Dynamicaly populate columns on insert/update

Created at: July 23, 2014; Last update: July 23, 2014

When I create some sort of admin panel, I usually want to know not only when a user created or edited an item (post), but also who that user was.

Considering this, I always add two additional columns to my tables: created_by and updated_by. This, along with the timestamps from Laravel, is the best way to keep track of latest changes of a database record. Continue reading