php - Automatically update a LOG table when there is a change in db from controller/model -


i using laravel 4.2. have been asked in interview how can able insert data database table, when using crud operations laravel controller/model etc.

i have achieved in way before sending data controller, update model like...

log::insert($data) 

in way there additional work in every controller. can use app::bind thing while implementing this?

what looking called model event

model::saved(function($user) {     log::insert($data) }); 

you might want check out tutorial using laravel 4's model events


Comments