How to check if new data is added in my database using fuelphp? I have a database that accept new users. I want to be notified if new user is added on the database. I already have email notification of the new registered but I want a notification inside the system, like for example I have if my db count now is 1000, and after 1 hour it's 1001 already so notification will show in my admin account "new user has registered.". My idea is to add a new table in my db that will count and save the old number of users and then check if the old value is the same of new count. But I don't want to add a table just for saving the number of users. Is it possible? Thanks
An observer executes a specific task, at a specific event.
Fuel comes with a few standard observers, like created_at and updated_at. The last_login column is specific to Auth, and is not used for this purpose, it's used to detect and block concurrent logins (unless you have enabled that). It is not updated using an observer.
But you can write your own observers, either as a separate class, or as a method in the model with the help of Observer_Self, see http://docs.fuelphp.com/packages/orm/observers/creating.html. If you trigger your observer on "after_insert", it will only be executed on a succesful insert.