Having a dress code is very important for the workers because it makes it much easier to spot them and get the help you food. Plus it keeps the hair out of your food soooo-
Yes, dress codes are enforced for safety. If someone has long hair and it isn’t out of the way of the job the manager should be able to enforce the dress code because it could catch on fire and is simply unsafe.