I've done a lot of research to find a solution, but I've only found a few libraries that sort through only one level.
$anuncios = Anuncio::with(['veiculo' => function($q){
$q->orderBy('nome', 'asc');
}]);
This way you are sorting only by the column "name", but I need to sort by the column of another table with relationship, for example "vehicle.mark.name". Is there a library that provides this operation or a code that could solve this problem?