You can grow just about anything in troughs. two years ago I tried cauliflower in a trough 5 foot long by 1 foot wide. Only 4 plants, but they were superb key to success was regular watering + feeding. Not sure what you'd feed carrots (if anything) but I'd water daily. This year I grew 4 giant onions in a small trough for the local gardening club I belong to and got 2nd prize with one of them at a weight of 3lb 4oz! Again I watered daily and fed them with pelleted chicken manure which had been dissolved in water. I didn't eat them!!
I grew both carrots and peas and I used multi-purpose compost and made sure they were well-watered during the summer months and as I said before, I got lovely baby carrots (very sweet) and peas as well.