Donald Trump said the two sides reached a ceasefire shortly after Iran attacked a US airbase in Qatar.