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

David_Cotton's avatar

Spark addSeat() method

Hello! I have been build an application for the last month. I would like to see if I could get some help.

Here is my SparkServiceProvider:

    Spark::useStripe()->noCardUpFront()->teamTrialDays(15);

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

    Spark::teamPlan('Per Project', 'prod_EtsGFJ9c5U0tE4')
    ->price(20)
    ->features([
    ]);

Here is my ProjectController@store

    $display = new Project;
    $display->team_id = Auth::user()->currentTeam->id;
    $display->device_id = $request->input('code');
    $display->name = $request->input('name');
    $display->save();

    return redirect('/project');

I am a little stuck on the $team->addSeat(); method. I do not know where or how I should add this. I assume I would add it after the new Project was saved? My goal would to learn how to charge a team per seat.

0 likes
1 reply
Cronix's avatar

Try getting the current users team, and add the seat to that

auth()->user()->currentTeam->addSeat();

just after you save the $display.

Please or to participate in this conversation.