Melt the butter in a saucepan and add the onions. Cook on a low heat for approx. 25 mins, or when the onions begin to caramalise. Stir occasionally.
Add the garlic and flour and stir for 2 mins. Slowly add the stock and wine, bring to the boil.
Add the bay leaf and thyme. Cover and simmer for 25 mins, after which remove the bay leaf and thyme. Check flavour, add salt and pepper if needed.
Preheat the grill (broiler). Toast the baguette slices. Divide among 6 soup bowls, then ladle the soup on top. Sprinkle with cheese, then return to the grill until the cheese melts and turns golden brown.