It depends on what you want to model. In the tutorial you link to, the purpose is to have one side of the slab model a real surface, and the rest is supposed to model bulk. In this case it is correct to do as written in the tutorial and constrain the bottom two layers.
In other cases you might want to use both sides of the slab as models for a surface, and in this case it could make sense to constrain the layers in the middle, but in general this would probably require a much thicker slab.