The resignation comes amid controversy over whether the PM broke the ministerial code.