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

allow closure on excludes #10

Merged
merged 1 commit into from
Oct 16, 2023
Merged

Conversation

zsp03
Copy link
Contributor

@zsp03 zsp03 commented Oct 3, 2023

This pull request allows Closure to be used on excludes, this is useful to enable custom logic for excluding panels. For example you can hide "admin" panel from switch if the user is not admin.

PanelSwitch::configureUsing(function (PanelSwitch $panelSwitch) {
    $panelSwitch->excludes(function (): array {
                    if (auth()->user()->role !== 'admin')
                        return ['admin'];
                    return [];
                })
        ]);
    });

@bezhanSalleh bezhanSalleh merged commit 68ef52e into bezhanSalleh:3.x Oct 16, 2023
1 check passed
@bezhanSalleh
Copy link
Owner

Thanks.

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.

2 participants