feat(billing): surface generic trial state on billing settings + 7d default
- BillingController::index reads onTrial from Account::isOnTrial() (covers generic trial without a Stripe subscription) and falls back to account.trial_ends_at when no subscription exists. Vue page already had the badge + 'Trial ends' UI wired — just needed the right props. - Drop default trial_days from 8 to 7 for consistency with messaging.
This commit is contained in:
parent
177e7f8681
commit
83f9e69eed
4 changed files with 6 additions and 6 deletions
|
|
@ -138,8 +138,8 @@ public function index(Request $request): Response|RedirectResponse
|
|||
|
||||
return Inertia::render('settings/account/Billing', [
|
||||
'hasSubscription' => $account->subscribed(Account::SUBSCRIPTION_NAME),
|
||||
'onTrial' => $subscription?->onTrial() ?? false,
|
||||
'trialEndsAt' => $subscription?->trial_ends_at,
|
||||
'onTrial' => $account->isOnTrial(),
|
||||
'trialEndsAt' => $subscription?->trial_ends_at ?? $account->trial_ends_at,
|
||||
'subscription' => $subscription?->only([
|
||||
'stripe_status',
|
||||
'ends_at',
|
||||
|
|
|
|||
|
|
@ -135,6 +135,6 @@
|
|||
|
|
||||
*/
|
||||
|
||||
'trial_days' => env('CASHIER_TRIAL_DAYS', 8),
|
||||
'trial_days' => env('CASHIER_TRIAL_DAYS', 7),
|
||||
|
||||
];
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
$starterPlan = Plan::where('slug', Slug::Starter)->firstOrFail();
|
||||
|
||||
expect($user->account->plan_id)->toBe($starterPlan->id);
|
||||
expect($user->account->trial_ends_at?->toDateTimeString())->toBe('2026-05-22 12:00:00');
|
||||
expect($user->account->trial_ends_at?->toDateTimeString())->toBe('2026-05-21 12:00:00');
|
||||
expect($user->account->stripe_id)->toBeNull();
|
||||
});
|
||||
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
'registration_ip' => '127.0.0.1',
|
||||
]);
|
||||
|
||||
Carbon::setTestNow('2026-05-22 12:01:00');
|
||||
Carbon::setTestNow('2026-05-21 12:01:00');
|
||||
|
||||
expect($user->account->fresh()->isOnTrial())->toBeFalse();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
$workspace->members()->attach($user->id, ['role' => Role::Member->value]);
|
||||
$user->update(['current_workspace_id' => $workspace->id]);
|
||||
|
||||
Carbon::setTestNow('2026-05-22 12:01:00');
|
||||
Carbon::setTestNow('2026-05-21 12:01:00');
|
||||
|
||||
$response = $this->actingAs($user->fresh())->get(route('app.accounts'));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue