Is there known science for turning on Team Billing in Laravel Spark?
That is, if you want to use Laravel Spark's team billing features, you need to create your project with the team-billing option.
However, (hypothetically, he lied) if you didn't create your project with the --team-billing
flag and suddenly needed the team billing features, is there a way to turn this on?
If not, is there a document list of the files you'd need to change?
I realize I could generate two new fresh projects, one with team billing and one without, and then diff the resulting projects to do this myself, but that seems an error prone route. I'd like to know if there's known science for this before heading down that path.
I investigated this one a bit on my own and have a solution that works as of July 14, 2017. This may change in a future Spark update, so YMMV. See below for the best way to check the difference between systems.
First, as mentioned elsewhere, you'll need to add the Laravel\Spark\CanJoinTeams
trait to your App\User
class.
#File: app/User.php
use Laravel\Spark\CanJoinTeams;
use Laravel\Spark\User as SparkUser;
class User extends SparkUser
{
use CanJoinTeams;
/* ... */
}
Second, you'll need to add team plans (instead of individual plans) in your spark provider. i.e. these defaults.
#File: app/Providers/SparkServiceProvider.php
public function booted()
{
Spark::useStripe()->noCardUpFront()->trialDays(10);
Spark::freePlan()
->features([
'First', 'Second', 'Third'
]);
Spark::plan('Basic', 'provider-id-1')
->price(10)
->features([
'First', 'Second', 'Third'
]);
}
Need to be
public function booted()
{
Spark::useStripe()->noCardUpFront()->teamTrialDays(10);
Spark::freeTeamPlan()
->features([
'First', 'Second', 'Third'
]);
Spark::teamPlan('Basic', 'provider-id-1')
->price(10)
->features([
'First', 'Second', 'Third'
]);
}
for team plans. Also, if it's not obvious, you can have both individual plans and team plans for a system at the same time.
If you're coming here years later and you want to see what's needed in your version of Spark, here's the best way I found to do it.
First, create a Spark project with team billing
spark new project-name --team-billing
and then rename the project-name
folder to something like with-team-billing
mv project-name with-team-billing
Then, do the same for a project without team billing
spark new project-name --team-billing
mv project-name without-team-billing
Then, recursivly diff the two folders with your favorite diff commands
diff -r with-team-billing without-team-bill
bbdiff with-team-billing without-team-bill
Creating both projects with the same name is important, as a number of node/npm files get generated with cached file path values. They're irrelevant to our goals, and only clutter up the diff results.