I need to add undo functionailty for crud form. If someone update or delete somthing by mistake how can they retrive his last content back.
In Laravel there is restore function I don't how to use that for making this functionality. I don't know how to freeze function for 30 sec until some kind of conformation come. If person click undo link or button deletion process should stop.
I want some kind of trick or code so that I can freeze function for 30 sec or if some kind of Laravel functions available for this thing..
Are you using soft delete. If so restore will work with withTrashed() on the model you want to undo the delete.
You can always ask user for confirmation before any operation is performed.
You can also use queues. Where in you push all such operations into the queue table. You can schedule a job that takes data from queue and perform the operation, before 30 seconds if you still don't want the action to proceed, remove it from the queue.