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 ability to filter the search results by a specific user #143

Closed
wants to merge 1 commit into from
Closed

Add ability to filter the search results by a specific user #143

wants to merge 1 commit into from

Conversation

beromir
Copy link

@beromir beromir commented Apr 30, 2023

This PR adds the ability to filter the search results by a specific user.
To do this, you must pass a user as the second argument to the search method.

->search($searchString, Auth::user())

You can specify the user column name in the model. Otherwise, user_id is used as the default column name.

public string $userColumn = 'custom_user_column';

@freekmurze
Copy link
Member

freekmurze commented May 3, 2023

Instead of making it user specific, let's make it more general. I'd accept a PR that adds a second parameter to search that accepts a callable to modify the query.

Also make sure to update the tests and add an example to the readme.

@freekmurze freekmurze closed this May 3, 2023
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.

None yet

2 participants