log action model & entity |
hii guys, i want to ask how and what is the best way to log inserted data, updated data compare before and after update, and deleted data
i use model entity
Can I have a more detailed explanation with examples? For comparison, there are method hasChanged()
(09-09-2023, 10:00 AM)ozornick Wrote: Can I have a more detailed explanation with examples? For comparison, there are method hasChanged() i mean is log activity action when i insert data it wil insert and save to my log table and when i update data it will just save updated data ex: i have field username - name and i change the name so the update will compare old value and new value any change will like this {"from" => 'oldvalue', 'to' => 'newvalue'} sorry my english is bad
Before updating, check the changed properties of the entity and save somewhere (log, other table)
PHP Code: <?php
As for your log files please see this:
CodeIgniter 4 User Guide - Modeling Data - Using CodeIgniter's Model - Callbacks What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(09-09-2023, 09:50 PM)InsiteFX Wrote: As for your log files please see this: so if i use after update model callback how can i compare old data and new data ? |
Welcome Guest, Not a member yet? Register Sign In |