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

Make Package class conditionable #118

Closed
wants to merge 1 commit into from

Conversation

geisi
Copy link

@geisi geisi commented Jan 22, 2024

Hello Spatie Team!

This is my first PR for this package.
This PR adds the Illuminate\Support\Traits\Conditionable trait to the Package class.

This enhancement empowers package maintainers with the flexibility to tailor their package behavior dynamically. For instance, it enables conditional package configuration as demonstrated below:

public function configurePackage(Package $package): void
{
    ...
    $package->when(config('package.enable_routes', false), fn(Package $package) => $package->hasRoute('package'));
}

I have not added any tests for this since it relies on a Laravel Core functionality, which is well-tested.

Thank you!

@freekmurze
Copy link
Member

Thanks for this PR. I'm going to pass on it because I think the vast majority of users of this package do not need.

Those who do can extend our provider and add the trait.

@freekmurze freekmurze closed this Jan 22, 2024
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