President Donald Trump has signed an executive order ending the process of separating children from families after they are detained crossing the US border illegally.