I have a plan with a feature called 'cards' that is set to type quantity.
How do I get this value based on the current user? For example, if the current user is subscribed to the 'Silver' plan that has a 'cards' quantity of '5', how do I get that value so I can use it?
Thanks
1 Answers
Best Answer
Hello,
Since users can have multiple subscriptions, first you need to get active subsctipnions
foreach(user()->activeSubscriptions() as $subscription){
$plan = $subsctiption->plan;
$plan_feature = $plan->features()->where(‘feature_id’, YOUR_FEATURE_ID )->first()?: null;
$value = $plan_feature->pivot->value;
}
}
Please login or Register to submit your answer