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

cannot filter searchable relation when adding the relation is blocked #6660

Closed
niekdemelker opened this issue Jan 9, 2025 · 0 comments
Closed
Labels
bug Verified bug by the Nova team fix incoming A fix is in review

Comments

@niekdemelker
Copy link

  • Laravel Version: 11.37.0
  • Nova Version: 5.1.1
  • PHP Version: 8.3.15

Description:

When you have a filterable and searchable relation but want to block setting this relation, the search remains empty. for example:

// License.php resource

BelongsTo::make('Tenant')
    ->searchable()
    ->filterable(),

When you have the above code, you will get the next filter

image

But when you block setting this relation in a policy your search results stay empty, the filter above will not work.

// TenantPolicy.php

public function addLicense(User $user, Tenant $tenant)
{
    return $this->deny();
}

Blocking to set a relation shouldn't disable the filter, when you may see the related resource you should be able to filter on it. the next line filters out all results in the example above: Laravel\Nova\Http\Controllers\AssociatableController:42

Detailed steps to reproduce the issue on a fresh Nova installation:

See above

@crynobone crynobone added bug Verified bug by the Nova team fix incoming A fix is in review labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified bug by the Nova team fix incoming A fix is in review
Projects
None yet
Development

No branches or pull requests

2 participants