Put 1 1/2 tbsp olive oil in a frying pan, add most of the sliced onions with some seasoning and cook over a medium heat for about 15 mins until soft and golden.
Meanwhile, heat the grill to high. In a large bowl, combine the mince, grated onion, ras el hanout, most of the pistachios, half of the parsley and some seasoning. Divide the mixture into 8 and shape into patties. Place on a baking tray and brush with 1/2 tbsp oil. Grill for about 10 mins, turning once, until browned and cooked through.
Add the apricot jam, a large pinch of zest and half the lemon juice to the cooked sliced onions, bubble down until thick, then set aside. To make the salad, mix the carrots, reserved sliced onions and remaining parsley in a bowl, then toss in the remaining lemon juice and olive oil and some seasoning. To serve, spoon the apricot relish into the pittas. Then add the koftas, salad, yogurt and remaining pistachios. Alternatively, serve the pittas open with the filling piled on top.