1 year ago

Ordering with Eloquent

Posted 1 year ago by Carlos_rsd

How to do the ordering in laravel by more than one field with the orderby () method? I have a query that should show the results ordered by the field TotalPoints and Birth, however, I can only do with one of the fields. See below:

$inscritos = Inscricao::join('Regioes','inscricoes.Regioes_IdRegioes','=','Regioes.IdRegiao') ->join('Turmas','inscricoes.Turmas_IdTurmas', '=' ,'turmas.IdTurmas')->where('Regioes_IdRegioes',$reg)->where('Atendido','N')->orderby('TotalPontos','Desc')->get();

What can I do to resolve this issue?

Please sign in or create an account to participate in this conversation.