After thirty years of this work , he was ordered by Valentinian to the imperial court to teach Gratian , the heir-apparent . After thirty years of this work , he was summoned by Valentinian to the imperial court to teach Gratian , the heir-apparent .