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 callable attributes support #12

Merged
merged 1 commit into from
Aug 17, 2022
Merged

Add callable attributes support #12

merged 1 commit into from
Aug 17, 2022

Conversation

talelmishali
Copy link
Contributor

@talelmishali talelmishali commented Aug 17, 2022

This PR adds support for callable attributes.

Onboard::addStep('Payments')
    ->cta('Complete')
    ->attributes(function (User $model) {
            return [
                'link' => $model->stripeOnboarding(),
            ];
    });

My use case

I came across a need for it on a project I am currently working on; one of the attributes (link, in my case) is a Stripe onboarding link (returned from a model method). Therefore, I can not simply use the route() helper or static address.

@riasvdv riasvdv merged commit 6316ae6 into spatie:main Aug 17, 2022
@riasvdv
Copy link
Member

riasvdv commented Aug 17, 2022

Thanks!

@talelmishali talelmishali deleted the callable-attributes branch August 18, 2022 02:34
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