Rather than discharge firearms to train a gun-shy beagle I have found it safer, easier, and cheaper to fold up a bunch of "caps" from a kid's cap pistol, place them in the jaws of a pair of pliers, and strike the jaws of the pliers against the gate post of the dog's pen. I take care to turn my head away to protect my eyes. After all, it's the noise, not the object which creates it, which frightens the dog.
I have had success re-training a beagle to be staunch to the gun by waiting until the dog is hungry, providing some food, and speaking quietly to the dog while he begins eating. Then I "fire" the caps, and continue to vocally reassure the beagle, who usually runs and hides in his dog house. I remove the food, wait a while for the beagle to recover, and repeat the food, talk, and fire sequence.
After a while the dog may tremble, but he will stay and eat the food after the explosion. In time the Pavlov effect will kick in and your beagle will rush to the site of the explosion rather than run and hide.
If using hunger to train your beagle not to be gun shy seems too cruel to you then you probably should give up hunting anyway.