I'd suggest to use '->attributes('key' => 'value')' on the Spark:: plan() in SparkServiceProvider to set your values and then filter based on it. You'd probably need a logged in user then to differentiate.
Only showing eligible plans on the subscription page
My application has two pricing tiers. The regular, and a lower rate for a few special people that I set manually. This is accomplished with a "tier" column in the users table, 0 is a regular customer and 1 is the lower rate. I have this technically working with the checkPlanEligibilityUsing feature like so:
Spark::checkPlanEligibilityUsing(function($customer, $plan) {
$tierMap = [
'plan1-standard' => 0,
'plan2-standard' => 0,
'plan3-standard' => 0,
'plan1-vip' => 1,
'plan2-vip' => 1,
'plan3-vip' => 1,
];
return $tierMap[$plan->id] === $customer->tier;
});
But of course, all six plans are visible on the subscription page. While I could probably hack something together on my own, I'd like to know what "the Spark way" of going about this is so while building, I have the right ideas. How can I ensure customers only see plans that match their tier?
Registration page is not relevant, users are something only I add.
Cheers
Please or to participate in this conversation.