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 append Nova filters to resource tests #1

Merged
merged 1 commit into from
Jan 28, 2022
Merged

Add ability to append Nova filters to resource tests #1

merged 1 commit into from
Jan 28, 2022

Conversation

amiranagram
Copy link
Contributor

This PR adds an ability to append Nova filters to getResource requests.
It reveals withFilter method that can be chained easily in tests.

Example:

use App\Nova\Filters\UserRoleFilter;

$this->modelClass::factory(10)->create();

$this
    ->withFilter(UserRoleFilter::class, 'admin')
    ->getResources();

As an array:

use App\Nova\Filters\UserRoleFilter;
use App\Nova\Filters\UserStatusFilter;

$this->modelClass::factory(10)->create();

$this
    ->withFilter([
        UserRoleFilter::class => 'admin',
        UserStatusFilter::class => 'active',
    ])
    ->getResources();

@bradenkeith bradenkeith merged commit b16dbb9 into romegasoftware:master Jan 28, 2022
@amiranagram amiranagram deleted the nova-filters-test branch January 28, 2022 19:26
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