Skip to content

Sortable not working in Nested Eager Loading, 4 or more Relation #1137

Open
@ghost

Description

I have a problem with yajra datatables. I`m following this

https://datatables.yajrabox.com/eloquent/relationships

But not working, if like this.

Example :

$account = People::with(['users.profile.country.state'])
Datatable::of($account)->make(true);

.....
columns : [
{name: 'users.profile.name', data: 'users.profile.name'},
{name: 'users.profile.country.state.name', data: 'users.profile.country.state.name'},
]
....

when I want to sortable users.profile.country.state.name I get error in query. "version for the right syntax to use near '.name" or "Call to a member function getRelation() on string"

thank.

UPDATE

sample (table like that):

// Table

- people :
 id
 id_user
 name

- users
 id
 username
 password

- profile
 id
 id_user
 name
 id_country

- country
 id
 name

- state
 id
 id_country
 name

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions