jamesdordoy / laravel-vue-datatable

Vue.js Datatable made for Laravel
https://jamesdordoy.github.io/laravel-vue-datatable
MIT License
151 stars 52 forks source link

Cannot Order By morph relation #71

Closed viandwi24 closed 2 years ago

viandwi24 commented 4 years ago

Previously it was resolved in the has one relation, has many, but the order did not work by directly writing it in {'column': 'admin.name'}, and there is no method for the relations of morp one? I've seen the documentation only contain hasOne, hasMany, and belongsToMany. Are there other ways to order columns directly? Is it not possible to use with (eager loading)? as :

$ column = 'account.name'; $ data = Users :: with ('account') -> eloquentQuery ($ column, $ dir, $ search) -> paginate ($ length); // and the account is a morphOne relation

thanks.

jamesdordoy commented 4 years ago

Hey @viandwi24,

This is not currently possible but it could be possible to achieve this using eager loading but i don't have the time to implement this. I would suggest using the query builder or if anyone else wants to add this functionality i am open to PRs.