@xspark The quickest way that comes to mind would be get the current plan
$user->current_billing_plan; // current plan is stored in the user or team table depending on your setup
And the simply get the Collection of all plans and retrieve the attributes you need from it (loop through it or whatever feels good to you):
Spark::plans()
Putting it together step-by-step this should do the trick:
$user = Auth::user(); // or any other way to get the user object
$current_plan_id = $user->current_billing_plan; // note that the way it is defined in spark the ID is not an integer but the slug e.g. 'free', 'pro'
// Spark::plans() give you a collection of all plans you have defined in SparkServiceProvider
$current_plan = Spark::plans()->where('id', $current_plan_id)->first();
$current_plan->attributes['max_posts']; // 3 if the current users plan is the PRO plan
- freePlan technically is not a plan defined on the database so you might need to catch it with an if statement or similar if that is needed
Instead of Spark::plans() you can do many other things out of the box, just browse through /spark/src/Configuration/ManagesAvailablePlans.php for what is available.