After a 54-46 vote, the measure now heads to Trump to sign into law hours before government funding was set to lapse.