Answers for "laravel OrderBy on Eloquent whereHas relationship"

PHP
-1

laravel orderby with relation

$users = User::with(['student' => function ($q) {
            $q->orderBy('id', 'desc');
        }]);
Posted by: Guest on May-04-2020
0

laravel OrderBy on Eloquent whereHas relationship

$counties = County::whereHas('items', function ($query) {
    $query->where('approved', 1);
})->orderBy('name')->get();
Posted by: Guest on May-07-2020

Code answers related to "laravel OrderBy on Eloquent whereHas relationship"

Browse Popular Code Answers by Language