Skip to content
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

Add parameter overrides to column searchable and sortable #234

Closed
wants to merge 1 commit into from
Closed

Add parameter overrides to column searchable and sortable #234

wants to merge 1 commit into from

Conversation

Blackpig
Copy link
Contributor

In reference to this discussion #51

This PR allows the ->searchable() and ->sortable() methods of the Column to accept a parameter to override a column's default search or sort behaviour.

Main example use case is where a resource column's value is accessed via a model's getXXXXXAttribute where the underlying field does not exist in the table definition. Refer to the above linked discussion for an example use case.

@danharrin danharrin added enhancement New feature or request pending review labels Mar 17, 2021
@danharrin danharrin mentioned this pull request Mar 23, 2021
@danharrin
Copy link
Member

Hey! Thanks for this. I've just rewritten this as part of #281, with some adjustments...

Originally, sorting on relationship columns was broken. I have fixed this, and you can now able to use multiple sort and search columns for them:

Column::make('customer.name')
    ->searchable(['first_name', 'last_name'])
    ->sortable(['first_name', 'last_name']);

@danharrin danharrin closed this Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pending review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants