I have 2 tables: users and activities. Both has the name field.
My grid function of ActivityController looks like this:
protected function grid()
{
return Admin::grid(Activity::class, function (Grid $grid) {
$grid->id('ID')->sortable();
$grid->column('user.username', 'Owner')->sortable();
$grid->column('name')->sortable();
$grid->created_at();
$grid->updated_at();
});
}
When I sort by name it works fine

But when I sort by Owner the name field replaced by name of the Owner

Is there anyone has this problem?
Problem exists and from here:
Before this code need add
$this->queries->push([
'method' => 'select',
'arguments' => [$this->model->getTable() . ".*"],
]);
its fix set equal fields from relation to eloquent model.
pr merged, Thanks!
Most helpful comment
Problem exists and from here:
https://github.com/z-song/laravel-admin/blob/1320bf488b115b546e5eb0ee9afea7baf4530dce/src/Grid/Model.php#L540
Before this code need add
its fix set equal fields from relation to eloquent model.