Apr 11, 2016
0
Level 6
Using a model other than User with Cashier
Hi,
I was reading through the messages here and I understand that Cashier can be configured to use a different model other than User.
I have an Organization model that I would like to use with Cashier instead. I have changed user_id in the subscription table to organization_id.
Schema::create('subscriptions', function ($table) {
$table->increments('id');
$table->integer('organization_id');
$table->string('name');
$table->string('stripe_id');
$table->string('stripe_plan');
$table->integer('quantity');
$table->timestamp('trial_ends_at')->nullable();
$table->timestamp('ends_at')->nullable();
$table->timestamps();
});
I've also updated the services.php file.
'stripe' => [
'model' => app\Organization::class,
'secret' => env('STRIPE_API_SECRET'),
'key' => env('STRIPE_API_PUBLISHABLE'),
],
I'm not sure where to go from there.
Please or to participate in this conversation.