After years of negotiations, the European Parliament has approved a major reform tightening the EU's migration and asylum rules.