What are some factors that contributed to the passage of laws requiring children to attend school in the late 1800s?