Pre-heat oven to 220°C.
Toast fennel seeds in a frying pan until aromatic and crush them in a mortar.
Activate yeast in warm water.
Mix flour, olive oil, yeast mixture, and crushed seeds to form a dough.
Knead the dough for two minutes, place in a bowl, and cover with a damp cloth.
Toss shallots and garlic cloves in olive oil and season with salt and pepper.
Bake shallots and garlic for 20 minutes until softened and colored.
Thinly slice fennel bulbs and sauté in olive oil until soft and golden.
Chop roasted shallots and peel the garlic flesh.
Combine fennel, shallots, garlic, goats' cheese, and ricotta once cooled.
Roll dough thinly and cut into four 16cm rounds.
Divide filling among rounds, fold over, and seal edges with water.
Bake pasties for 20-30 minutes.
Brush with beaten egg for the final five minutes of baking until golden brown.
Cool slightly before serving.