savannabits/primevue-datatables

Relationship with json column seems not to work when filtering and searching

aerrata opened this issue · 0 comments

Hi! Thanks for your work. I am trying to use json column with Laravel but I encountered some small issue with the json column relationships.

I have this set of data, notice the name is inside the json datatype column
image

User.php

public function country()
{
    return $this->belongsTo(Country::class);
}

Index.vue

const params = {
  params: {
    dt_params: JSON.stringify(lazyParams.value),
    searchable_columns: JSON.stringify(['name', 'email', 'country.data.name']),
  }
}

Unfortunately, it return this error when I load the datatable

Call to undefined relationship [data] on model [App\\Models\\Country].

Thanks.