Yes, the depth of focus is controlled by the f-stop. That is determined by the lens. An f1.8 is extremely small (or large, depending on if you’re talking about the number or the related physical size of the aperture) which means it will have a very small depth of focus.
Basically, if you had a 50’ ruler stretched out from your feet, at f1.8, you’d have a very small section of the ruler perfectly in focus, say from. If you went to something like f18 or f22, you’d have a much larger section of the ruler in focus.