laravel orderby with relation
snippet in php

laravel orderby with relation

user5589

$users = User::with(['student' => function ($q) {
            $q->orderBy('id', 'desc');
        }]);