凡事:n.everything, all things. 凡事有利有弊。
所有:1,n.possession. 为买房,我倾其所有。
2, adj.all. 我认识这里所有的人。
3,v.own. 这本书归我所有。
Regarding your question, I estimate that your confusion is from 凡事---所有2. They are the same conception about ALL, but Parts of Speech.
Therefore, your sentence could be also: 所有(的)事情都要小心。= 凡事都要小心。
The other sentence 凡事(的)学生都很乖。should be 所有的学生都很乖。Here you need an adjective before 学生. instead of 凡事 which is a noun, means all things.