Spark - Per Seat Target Types

Posted 1 year ago by brysonreece

Hey there, I'm currently working with a Laravel Spark instance that should allow users to customize subscriptions for different types of products.

To begin, I know I can call

Spark::chargeTeamsPerSeat('Projects', function ($user) {
    return $user->projects()->count();
});

Spark::teamPlan('Basic', 'team-basic')
    ->price(10)
    ->features([
        'First', 'Second', 'Third'
    ]);

in my app/Providers/SparkServiceProvider.php file.

As it stands, Spark seems to only allow (from what I can tell) mass assignment of one plan to each project instance.

A solution I'm looking for would allow a Team owner to customize plan types for each individual project; something similar to

Spark::chargeTeamsPerSeat('Projects', function ($user) {
    return $user->projects()->count();
});

Spark::teamPlan('Basic', 'team-project-basic')
    ->price(10)
    ->features([
        'First', 'Second', 'Third'
    ]);

Spark::teamPlan('Intermediate', 'team-project-intermediate')
    ->price(20)
    ->features([
        'First', 'Second', 'Third'
    ]);

Spark::teamPlan('Advanced', 'team-project-advanced')
    ->price(30)
    ->features([
        'First', 'Second', 'Third'
    ]);

allowing Teams to have a mix of "Basic", "Intermediate", and "Advanced" projects instances billed.

Any help would be greatly appreciated. Thanks!

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.