finchy70
1 week ago

Sort by relationship and paginate

Posted 1 week ago by finchy70

I have a query that I have tried to sort by relationship. Firstly this has not sorted all the results by engineer. Also how do I paginate the result?

$qualification_list = Qualification::with('engineer', 'course')->get()->sortBy('engineer.name');

I have tried ->paginate(15); at the end and also

$qualifications = $qualification_list->paginate(15);

Please help me sort by the relationship and then paginate the result..

Paul

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