Preventing vs. allowing urges

I’ve asked a similar question to this before but I’m still not quite clear on the concept. I find that if I limit the foods and wine I have at home and also prep meals ahead of time, I am way more likely to stick with the protocol and allow urges to eat off protocol. But if I’m not in my controlled environment or I don’t have a clear plan or anything prepared, I don’t even recognize my urges. An example is that I make little snack bags of peanuts and raisins (2 tbsp each) and have that every afternoon around 3pm. It’s the perfect amount for me to keep going in the afternoon and not be “starving” for dinner. Yesterday, I forgot my snack at home so I went to the convenience store to get a trailmix that had nuts and dried fruit. And rather than my normal controlled portion, I ate handful after handful. Similar things have happened when I go out to dinner or don’t have time to plan or prepare my meals ahead of time and have to wing it. So I guess my question is – by preparing my food and portions ahead of time, am I just preventing myself from having urges or maybe making them more manageable? So then when circumstances are less controlled or defined, I don’t recognize an urge? Or should I be aiming to have every day as controlled and defined as possible so there are no opportunities to just wing it? Or maybe I’m viewing the lack of a plan as an opportunity to just do whatever I feel like in the moment?
Any insight would be very much appreciated. Thanks so much!