i need to be able to update a model, and keep an old copy of it temporarily
guys, need a solution: i need to be able to update a model, and keep an old copy of it temporarily; seems when i use a replicated model, and call a relation on that model, laravel grabs the updated model. i want to generate an email that has the old info and new info (which is the same model), but somehow it falls apart as mentioned; i’m hoping to be able to keep the old model so i can leverage relations, etc, rather than do a data object
No any search results
You already invited:
3 Answers
Daryl k
Upvotes from: agrath
you have to do: $object2 = clone $object; Some basic testing using tinker seems to suggest this works as expected. I keep seeing the old values.
Menya Tom
Upvotes from:
CHINTAN PATEL
Upvotes from: