softopia
1 year ago

Track changes in a model and store in other table

Posted 1 year ago by softopia

Hello everyone, in my very simple application I need to track one table when i update a record & want to save that in DB to I can show the changes in a view.

I want something like "{Field One} Updated From {OLD VALUE} to {New value}"

I am able to do to almost everything with the help of this amazing article Posted on Medium.

https://medium.com/sammich-shop/simple-record-history-tracking-with-laravel-observers-48a2e3c5698b

Now the problem is, with the help of that article I am getting a result like "{Field One} Updated to {New VALUE}" but I also want to show the old value.

I tried to use "getOriginal()" but I think I am not implementing that in the right place and in a right way.

All the code I have used is same as the Article which you can see through the link.

Please Help me to show a message like

{Field One} Updated From {OLD VALUE} to {New value}

Please sign in or create an account to participate in this conversation.