0
I did a lot of research to find a solution, but I only found a few libraries that perform sorting with only 1 level.
$anuncios = Anuncio::with(['veiculo' => function($q){
$q->orderBy('nome', 'asc');
}]);
This way it is ordering only by the column "name", but I need to sort by the column of another table with relationship, for example, "vehicle.marque.name". There is a library that provides this operation or a code that could solve this problem?
Put these models in question and relationships.
– novic
Let’s assume that I have the following models: Countries, states and cities. I have a list of all cities in all countries. How to sort cities from country names?
– Adriano de Azevedo