You attract what you look for
If you look for the opportunity you will attract one! but if you keep on looking at your downfall\failure, soon you will find yourself surrounded by self-doubt and low confidence.
At a time, you might feel you are losing all the hopes, but trust me it's sign of new beginning!...
I left my first job and it was tough decision with no other way left. It was more than 6 month with no particular project/task assigned. I was the most unproductive member of team.😔 I started losing all the hopes and confidence. After lots of jumbling thoughts, finally I decided to leave my first job.
Now, after a year in my second job, lots of things as changed. I am building things, writing blogs, mentoring and guiding other developers. I took it as a lesson not as my loss and ultimately it became a motivation to do better, to dream bigger.
Everything will come to you, don't lose hope, not now! Take it in a positive way.