Skip to content

Conversation

@Seb33300
Copy link
Contributor

@Seb33300 Seb33300 commented Apr 22, 2025

Alternative to #3229

Not sure which implementation is better, I will let you choose what you prefer.

I would like to suggest to make resolveRelationColumn() a public method so we can reuse it in our custom filters:

$datatable = new EloquentDataTable($query);

$datatable
    ->filter(function ($query) use ($datatable) {
        // resolveRelationColumn automatically create joins if needed
        $column = $datatable->resolveRelationColumn('foo.bar');
        $query->where($column, 'xxx');
    })
    ->filterColumn('foo.bar', function ($query, $keyword) use ($datatable) {
        // resolveRelationColumn automatically create joins if needed
        $column = $datatable->resolveRelationColumn('foo.bar');
        $query->where($column, 'xxx');
    })
;

@Seb33300
Copy link
Contributor Author

Since #3229 is merged, this on is no longer needed.

@Seb33300 Seb33300 closed this Apr 28, 2025
@Seb33300 Seb33300 reopened this May 2, 2025
@sonarqubecloud
Copy link

sonarqubecloud bot commented May 2, 2025

@Seb33300 Seb33300 closed this May 2, 2025
@Seb33300 Seb33300 deleted the public-resolveRelationColumn branch May 8, 2025 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant