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

cib88's avatar
Level 2

Seat based subscription where a user can add sub users to their account

Hello,

I'm trying to spec out a project, the client needs a subscription based website that allows a user to select if they are a single person or organisation. If the latter then the user can select how many users they want to purchase a subscription for.

Let's say they choose 5 seats then register and pay, within their dashboard, there needs to be an option to add and remove up to 5 users with a name, email password.

I previously build a subscription service for single users using cashier but not sure this will work for this scenario. I've been looking into Spark which has the option for seat-based subscriptions just not sure how this will tie into the main user assigning child users to their account with their own credentials, anyone had experience with this and know any good resources/tutorials?

Thanks

0 likes
4 replies
eins's avatar

Can't you just do it manually ? a User Model contain main users and sub users with another model to attach each main user to his sub users ?

cib88's avatar
Level 2

@eins I was thinking that originally to be honest, so when the master user adds a sub-user via the dashboard just create the user and add them to the user's table? I could copy the master user's subscription details so if their subscription expires so does the sub-user.

eins's avatar

@cib88 You can also put the data shared between them in a separate table and identify it always by its main user, in case you want to access it from a sub user then look out for its main then the data

cib88's avatar
Level 2

The client put this project on hold, but I've recently picked it back up. For anyone who stumbles across this post looking for a similar issue, I achieved this by using the incrementQuantity function within cashier. The user fills in a couple of details I get the requested data and increment the quantity. The users are all stored in the user's table and I copy over the stripe ID to the new users so I can get each users within a subscription when needed.

public function addSubscription(Request $request)
    {

        $userId = Auth::id();
        $user = User::find($userId);
        $stripeId = Auth::user()->stripe_id;

        $request->validate([
            'first_name' => 'required|string|max:55',
            'last_name' => 'required|string|max:55',
            'email' => 'required|string|email|max:255|unique:users',
            'password' => ['required', Rules\Password::defaults()],
        ]);

        $user->subscription('primary')->alwaysInvoice()->incrementQuantity();

        User::create([
            'first_name' => $request->first_name,
            'last_name' => $request->last_name,
            'email' => $request->email,
            'password' => Hash::make($request->password),
            'stripe_id' => $stripeId,
        ])->assignRole('user');

        return Inertia::render('User/Dashboard', ['messages' => 'user added successfully']);
    }

Please or to participate in this conversation.