Level 3
Bump. Anyone?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello everyone,
I am currently working on a webapp that require me to calculate signup seats (to display pricing) before user signs up. The Spark documentation has this snippet:
Spark::chargePerSeat('Projects', function ($user) {
return $user->projects()->count();
});
This works well when the user is logged in but I have a situation when the customer is already selecting a number of seats they want to order. How can I calculate pricing based on seats they are attempting to order, I tried:
Spark::chargePerSeat('Projects', function ($user) {
return request('num_seats');
});
But the code never executes it seems as the user is not logged in.
Please or to participate in this conversation.