currentOrganization()->first(); } /** * Get the current subscription, if there is one. */ #[Computed] public function subscription() { return $this->organization?->currentSubscription(); } /** * Get the plan the organization is on, falling back to a description built * from the raw Stripe status for states that are not a plan. * * @return array{name: string, price: string, interval: string}|null */ #[Computed] public function plan(): ?array { return $this->organization?->currentPlan(); } /** * Get a human readable label for the subscription status. */ #[Computed] public function status(): string { $subscription = $this->subscription; if ($subscription === null) { return __('No subscription'); } return match ($subscription->stripe_status) { 'active' => __('Active'), 'trialing' => __('Free trial'), 'past_due' => __('Past due'), 'canceled' => __('Canceled'), 'unpaid' => __('Unpaid'), 'incomplete' => __('Incomplete'), 'incomplete_expired' => __('Expired'), default => ucfirst((string) $subscription->stripe_status), }; } /** * Describe the state of the current subscription in a single sentence. */ #[Computed] public function summary(): string { $subscription = $this->subscription; if ($this->organization?->hasLifetimeAccess() === true) { return __('Lifetime access. No subscription is required.'); } if ($subscription === null) { return __('You are on the free plan and cannot use your workspace until you subscribe.'); } if ($subscription->ends_at !== null && $subscription->ends_at->isFuture()) { return __('Your plan stays active until :date. Subscribe again to keep your access after that.', [ 'date' => $subscription->ends_at->toFormattedDateString(), ]); } if ($subscription->trial_ends_at !== null && $subscription->trial_ends_at->isFuture()) { return __('Your free trial ends on :date.', [ 'date' => $subscription->trial_ends_at->toFormattedDateString(), ]); } return __('Your subscription renews automatically.'); } /** * Determine whether the customer portal button should be shown. The portal * only exists once Stripe knows about the organization as a customer. */ #[Computed] public function canManagePaymentMethod(): bool { return $this->organization?->hasStripeId() === true; } }; ?>
@include('partials.settings-heading') {{ __('Billing settings') }}
{{ $this->plan['name'] ?? __('Free') }} {{ $this->status }}
{{ $this->organization?->isEntitled() ? __('Active') : __('Inactive') }}
{{ $this->summary }}
@if ($this->organization?->isEntitled() !== true) {{ __('Subscribe') }} @endif @if ($this->canManagePaymentMethod)
@csrf {{ __('Manage payment method') }}
@endif