codekerala / spa-laravel-vuejs

Single Page Application with Laravel 5.3 and Vue.js 2.1.x
https://codekerala.com
154 stars 82 forks source link

Sorting related model #6

Open t0n1zz opened 6 years ago

t0n1zz commented 6 years ago

so i find your sorting code not working if we are sorting related model and i find elsewhere the solution is doing something like this

$users = App\User::with(['posts' => function ($query) {
    $query->orderBy('created_at', 'desc');
}])->get();

but i don't know how to add that into FilterPaginateOrder trait so it will also work with related model sorting... can you help me please?