F
Filament8mo ago
Wim

Spark's current subscription plan in Filament Form

I'm integrating Laravel Spark with Filament. I would like to show the user's current subscription in a Form (on the Profile page) I can get the subscription as follows:
$organization = auth()->user()->organizations()->first();
$subscription = $organization->subscriptions()->first()->stripe_price;
$organization = auth()->user()->organizations()->first();
$subscription = $organization->subscriptions()->first()->stripe_price;
return $form
->schema([
Grid::make(4)
->schema([
Section::make('Current Subscription')
->schema([
TextInput::make($subscription)
->label('Subscription')
->readonly(),
])
return $form
->schema([
Grid::make(4)
->schema([
Section::make('Current Subscription')
->schema([
TextInput::make($subscription)
->label('Subscription')
->readonly(),
])
Obviously this does not work. Any idea how I can show the current user's subscription For info, here's the relevant database section:
Schema::create('subscriptions', function (Blueprint $table) {
$table->id();
$table->foreignId('organization_id');
$table->string('stripe_id')->unique();
$table->string('stripe_status');
$table->string('stripe_price')->nullable();
$table->integer('quantity')->nullable();
$table->index(['organization_id', 'stripe_status']);
}

Schema::create('subscription_items', function (Blueprint $table) {
$table->id();
$table->foreignId('subscription_id');
$table->string('stripe_id')->unique();
$table->string('stripe_product');
$table->string('stripe_price');
});
Schema::create('subscriptions', function (Blueprint $table) {
$table->id();
$table->foreignId('organization_id');
$table->string('stripe_id')->unique();
$table->string('stripe_status');
$table->string('stripe_price')->nullable();
$table->integer('quantity')->nullable();
$table->index(['organization_id', 'stripe_status']);
}

Schema::create('subscription_items', function (Blueprint $table) {
$table->id();
$table->foreignId('subscription_id');
$table->string('stripe_id')->unique();
$table->string('stripe_product');
$table->string('stripe_price');
});
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server