laravel hasmany sortby code example
Example: laravel orderby with relation
$users = User::with(['student' => function ($q) {
$q->orderBy('id', 'desc');
}]);
$users = User::with(['student' => function ($q) {
$q->orderBy('id', 'desc');
}]);