Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjaparade committed Dec 21, 2023
1 parent d446bb8 commit 1e1b8fa
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 2 additions & 0 deletions config/stripe-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@
'stripe_account' => env('STRIPE_ACCOUNT', null),
'client_id' => env('STRIPE_CLIENT_ID', null),
],

'customer_class' => null,
];
1 change: 1 addition & 0 deletions database/migrations/create_stripe_data_table.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ return new class extends Migration
Schema::create('stripe_customers', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->foreignId('account_id')->nullable()->index();
$table->string('email')->nullable();
$table->integer('balance')->default(0);
$table->string('stripe_id');
Expand Down
17 changes: 17 additions & 0 deletions src/Models/StripeCustomer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Ninjaparade\StripeData\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Ninjaparade\StripeData\Models\Casts\StripInvoiceSettingCast;

class StripeCustomer extends Model
Expand All @@ -23,4 +24,20 @@ class StripeCustomer extends Model
'balance' => 0,
'delinquent' => false,
];

public function tenant(): BelongsTo
{
return $this->belongsTo(
config('stripe-data.tenant_model'),
'tenant_id'
);
}

public function account(): BelongsTo
{
return $this->belongsTo(
config('stripe-data.customer_model'),
'account_id'
);
}
}
4 changes: 0 additions & 4 deletions src/Models/StripePrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,10 @@ class StripePrice extends Model

protected $casts = [
'type' => BillingType::class,
// 'unit_amount' => 'integer',
// 'recurring' => 'array',
'recurring' => 'json',
'metadata' => 'json',
// 'active' => 'boolean',
];

//
protected $attributes = [
'metadata' => [],
'recurring' => [],
Expand Down

0 comments on commit 1e1b8fa

Please sign in to comment.