Skip to content

feat: Public visibility for resolveRelationColumn method #3228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

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
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