Learn how to configure your Spark Stripe application.
App\Models\Team
model your billable model, you first need to adjust Spark’s default migrations:
2019_05_03_000001_add_spark_columns_to_users_table.php
file to 2020_05_03_000001_add_spark_columns_to_teams_table.php
. Adjusting the “year” of the migration will ensure the migration is run after the teams
table is created in the database.
After renaming the migration, you may update its contents such that it updates the table definition of the teams
table instead of the users
table. Also, update the first column so that it is added after a field on the teams
table instead of remember_token
.
Next, update the subscriptions
table migration to contain team_id
instead of user_id
. You should also ensure that you update the column in the migration’s index as well.
SparkServiceProvider
to reference the Team
model instead of the User
model:
Team
model to use the Spark\Billable
trait and implement a stripeEmail
method that returns the team owner’s email address to be displayed in the Stripe dashboard as the customer identifier:
config/spark.php
configuration file so that it defines a team
billable model: