On a baking sheet, toss the broccoli florets, onion, garlic, red pepper flakes, salt, pepper in the olive oil to coat. Roast for 25 minutes or until broccoli gets crispy and starts to brown. Remove from the oven and let cool for a couple minutes.
Heat a skillet to medium and butter one side of each slice of bread. Put one piece of bread butter side down in the hot skillet, then top with pesto, 2 slices of cheese, 1/2 the broccoli mixture, 2 more slices of cheese and another slice of bread, butter side up.
Cook for 5-6 minutes or until the bottom bread is browned and the cheese is starting to melt. Flip carefully and cook another 5 minutes or until done. Repeat with second sandwich.