Why Do Hotels Ask for ID When Going in the Premises

Big hotels, sometimes even the middle-class hotels must scan and check the IDs of all customers coming into the restaurant.