I accidentally deleted a Controller. How to recover?
Hello.
I accidentally deleted a Controller.
The last backup was two days ago. These two days I had made too many improvements and changes in this Controller. Is there any case to recover?? Is there some Recycle Bin for Larave?
If you use version control, such as Git, recovery is easy. Every developer should always use version control, even if they're working alone.
Another easy way is through an IDE. PhpStorm has a local history that shows file deletions, which you can revert. VS Code is a bit worse in this regard, but it's still possible.
Otherwise, you might be able to do it with some recovery tool. Recovering deleted files is less likely on SSDs than HDDs. Your best bet is to google "undelete tool" and try something to recover it. Recovery becomes less and less likely the longer you keep using the device.
No, recovering your local deleted files is out of Laravel responsibility. You should search in your local system for such things.
If you use version control system (most likely Git) and committed your controller then search there. But I'm afraid that's not the case otherwise you wouldn't ask.
As last chance you can use some data recovery software and most likely you'll find your file as deleted files are not actually erased from disk. I successfully used R-Studio: https://www.r-studio.com/
But I think rewriting the class is the best option for you. It is not so hard to do, you'll polish the logic at the same time. Rewriting actually helps.
If you're using vscode, there is timeline local history that can be used to retrieve lost file. This only if you're not clearing any temporary file in your OS
@adamnet You keep making the same mistake and asking the same question. Either accept that you'll occasionally lose work, or start using version control. If you want to be a serious developer, learn version control.