Skip to content

Conversation

@Seb33300
Copy link
Contributor

@Seb33300 Seb33300 commented Apr 22, 2025

Alternative to #3228

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

I would like to suggest to add resolveRelationColumn() as new param to the filter callbacks:

$datatable = new EloquentDataTable($query);

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

@sonarqubecloud
Copy link

@yajra
Copy link
Owner

yajra commented Apr 28, 2025

I like the resolver idea, thanks!

@yajra yajra merged commit 8eed3e8 into yajra:master Apr 28, 2025
6 of 7 checks passed
@yajra
Copy link
Owner

yajra commented 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.

2 participants