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 steps to be limited to specific classes #15

Merged
merged 4 commits into from
Sep 24, 2022
Merged

Allow steps to be limited to specific classes #15

merged 4 commits into from
Sep 24, 2022

Conversation

RhysLees
Copy link
Contributor

@RhysLees RhysLees commented Sep 24, 2022

This PR aims to allow steps to be limited to specific classes which allows you to setup steps for multiple models for example if you have steps for users and teams.

Example Usage:

// Defining User steps
Onboard::addStep('Limited User Step', User::class)
    ->link('/post/create');

// Defining Team steps
Onboard::addStep('Limited Team Step', Team::class)
    ->link('/post/create');

// Defining a step that is available to all classes
Onboard::addStep('Normal Step')
    ->link('/post/create');

The above will result in 1 step being available to all classes, and 2 steps being available to the User and Team classes:

Other classes will only see the Normal Step.
User classes will both see the Normal Step and Limited User Step.
Team classes will both see the Normal Step and Limited Team Step.

This should be a non breaking change as you are still able to define steps the same as before. Also, when you specify a class, it will merge the class steps and non-class specific steps as seen in the example above.

Solves: #8

image

src/OnboardingSteps.php Outdated Show resolved Hide resolved
@RhysLees RhysLees requested a review from freekmurze September 24, 2022 13:15
@freekmurze freekmurze merged commit bc0de35 into spatie:main Sep 24, 2022
@freekmurze
Copy link
Member

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