Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

cplummer3's avatar

Can you limit the generic trial teams?

I was wondering if there is a built in way to limit the max amount of teams a trial account can create when using teams. Couldn't find anything in the docs or in the code bbut it seems like a no brainer so wanted to make sure i'm not missing anything. Thanks!

0 likes
4 replies
aseipp's avatar

Struggling with this also, I've tried setting up a limit in the service provider with no luck. Tearing my hair out trying to make it work.

cdubant's avatar

@Cronix : OP's question is about constraining the number of teams that a user can create while ona generic trial (or other trial).

What you refer to is constraining the ability to subscribe / upgrade or downgrade to a given plan.

I think there's no way to control this before the team is created.

We can tweak it with deleting the team right after it was created (using the generated event). But this pattern sucks and we shouldn't do it this way. Though it seems to be the only way..

Cronix's avatar
Cronix
Best Answer
Level 67

@cdubant you can override every single thing in spark. You can just register your own class into the container and it will use your class instead of Sparks native class. This is often better than using swap methods as you still have access to $this, etc.

Like in SparkServiceProvider, I do:

public function register()
{
    Spark::minimumPasswordLength(8);

    $this->app->singleton(
 'Laravel\Spark\Contracts\Interactions\Settings\Profile\UpdateContactInformation',
        'App\Http\SparkExtensions\UpdateContactInformation'
    );
}

to use my custom class to update contact info instead of sparks.

My UpdateContactInformation is just an exact copy of the original, and just:

use Laravel\Spark\Interactions\Settings\Profile\UpdateContactInformation as SparkUpdateContactInformation;

class UpdateContactInformation extends SparkUpdateContactInformation`
{

}

along with my customizations to existing methods.

I'm sure it wouldn't be difficult to check how many teams a trial user has before allowing them to create more, or whatever else you'd like to do. It's just laravel, and laravel makes this stuff pretty easy.

1 like

Please or to participate in this conversation.