I am looking for the same resource, like a dynamic plan that can be generated dynamically.
Custom plans
Hi,
Does anyone knows if it's possible to create custom plans in Spark? I mean if a user requests a plan that is not available for all users.
Thanks, Regards, Ronnie
I have done with adding spark plans in the service provider dynamically via database.
Works perfect!
can you explain how you did it?
Create a table with the required columns. Out put the query in a foreach loop. Done. Gotta think on your feet!
Exactly,
Make sure the price you enter is cast to a double otherwise all your prices go times 10...
That's easy for all the properties where the value from the dabase would go in as an argument. But how to add ->yearly() method if 'interval' => 'yearly'? Same goes for ->archived() for example.
$plansDB = DatabasePlan::all();
foreach($plansDB as $plan)
{
Spark::Plan($plan->name, $plan->slug)
->price($plan->price)
->maxTeams($plan->maxTeams)
// How to add ->yearly() OR -> archived() depending on DB value???
;
}
An isset() inline statement does not work and if() also does not work.
Is there an elegant way beyond nesting foreach loops for all cases?
how about
$plan = Spark::Plan($plan->name, $plan->slug)
->price($plan->price)
->maxTeams($plan->maxTeams);
$plan->archived();
not sure, but think it would work
Good idea, it does work in fact - with some minor twists (the 2 variables must be different). Here is a working setup for future use.
$plansDB = DatabasePlan::all();
foreach($plansDB as $plan)
{
$sparkPlan = Spark::Plan($plan->name, $plan->slug)
->price($plan->price)
->maxTeams($plan->maxTeams)
;
$plan->interval == 'yearly' ? $sparkPlan->yearly() : '';
$plan->archived == true ? $sparkPlan->archived() : '';
}
Could this possibly work to allow Dynamic pricing based on the number of Records in a mysaql database? For example, if one of my clients has 5,000 employees in my sequel, I need to be able to charge them 5000 times $0.10 equals $500.
Please tell me how i create custom daily plan in laravel spark.
Please or to participate in this conversation.