Preheat the Oven: Preheat your oven to 375°F (190°C). Lightly grease a 9x13-inch baking dish with butter.
Sauté the Onions and Garlic: In a large skillet or saucepan, melt the butter over medium heat. Add the sliced onion and sauté until softened and translucent, about 8 minutes. Add the minced garlic and cook for an additional 1 minute until fragrant.
Make the Roux: Sprinkle the flour over the onions and garlic, stirring constantly, and cook for 1-2 minutes to eliminate the raw flour taste.
Prepare the Sauce: Gradually whisk in the heavy cream ensuring a smooth mixture. Add the bay leaves, parsley, thyme, paprika, nutmeg, salt, black pepper. Cook over medium heat, stirring frequently, until the sauce slightly thickens. Remove from heat and stir in 1 ½ cup of the Gruyère cheese and a 1/2 cup of grated parmesan cheese until melted and smooth.
Layer the Potatoes: Spoon a thin layer of the cream sauce into the bottom of the baking dish. Arrange half of the potato slices in an even layer in the prepared baking dish. Pour half of the cheese sauce over the potatoes, spreading it evenly to coat them. Lightly sprinkle grated Parmesan cheese over the top and an additional sprinkle of salt and pepper on this layer. Repeat with the remaining potato slices and cheese sauce, using a spatula to scrape out every last drop. Finish with another light, even sprinkle of grated Parmesan cheese, salt and pepper.
Top with Cheese: Sprinkle the remaining Gruyère cheese over the top.
Bake: Cover the baking dish tightly with aluminum foil and bake in the preheated oven for 45 - 50 minutes. Remove the foil and continue baking uncovered for 30-45 minutes, or until the potatoes are fork-tender and the top is golden and bubbly.
Rest and Serve: Let the dish rest for 20 minutes after removing it from the oven to allow the sauce to thicken and set.