to get rid of them first understand why you have them
1 fungus gnats are caused from to much water in your soil if your soil is dry they cant survive
2 fungas gnats are an essential part of nature they help compost raw organic material so if you are using organic soil like ffof this could be how you got them in the first place
Diatomaceous earth, safers end all catapillar dust with BE can be mixed in to your soil and will kill FG for months+
if you are running an organic grow nematodes can be sprinkled in to your soil they will eradicate them quickly but any nutes with salt in them will kill nematodes