Have you tried to bake your spaghetti before?
Add in the garlic and continue stirring it together until the onions are soft and translucent.
Whisk them together until the cheese has melted, is smooth, and fully incorporated.

Image Credit: Simply Mamá Cooks via YouTube
Add in your cooked and drained pasta, mix until it is well coated.
you could also broil it on high for 2 to 3 minutes.
Garnish it with parsley then serve or let it cool down for 5 to 10 minutes.

30-Minute Cheesy Baked Spaghetti Recipe
