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

Fix server side relationship search #5754

Open
wants to merge 3 commits into
base: 1.6
Choose a base branch
from

Conversation

samiksengupta
Copy link

This fixes the issue with Voyager's server side searching.

This potentially fixes #5645 #5635 #5433 #5412

This issue can be recreated by enabling Server-side Pagination in BREAD and then having a relationship field.

server-side

relationship

Now upon searching the relationship field in browse view, an exception occurs.

searching-role

exception

This fixes fixes duplicate filter field occurance and enables multiple relationship fields sharing same reference column

This also fixes the duplicate filter dropdown entries when there is a non-relation field sharing the same name with a relationship reference column name in the same BREAD.

bread-fields-duplicate

search-keys-repeats

Note that this will not affect multiple relation fields in a BREAD sharing the same relationship reference column name (but different display column for instance).

This allows use of custom relationship methods in eloquent models

If you are using a custom relationship method in your eloquent model, you can mention that method name in Relationship Details as long as you have specified your model in BREAD.

public function group()
{
    return $this->belongsTo(\TCG\Voyager\Facades\Voyager::modelClass('Role'), 'role_id');
}

customize-model

custom-relation

If a name is not specified, the relationship method name will be determined from the model name.

@pckz
Copy link

pckz commented Dec 8, 2023

awesome work! thanks @samiksengupta
please @eclairAB review this PR 🙏

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.

server-side search on relationships
3 participants