Skip to content

Commit 47459a2

Browse files
committed
fix: only add billing info if user is logged in
1 parent a025a51 commit 47459a2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Inertia.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,13 @@ public static function getSharedProps()
129129

130130
$subscription = $user ? auth()->user()->subscription() : [];
131131

132-
$shared['user'] = $shared['auth']['user'] = array_merge($shared['user'] ?? [], [
133-
'hasSubscription' => !!$subscription,
134-
'subscription' => $subscription,
135-
'isOnTrial' => ($subscription['status'] ?? false) === \Leaf\Billing\Subscription::STATUS_TRIAL,
136-
]);
132+
if ($user) {
133+
$shared['user'] = $shared['auth']['user'] = array_merge($shared['user'] ?? [], [
134+
'hasSubscription' => !!$subscription,
135+
'subscription' => $subscription,
136+
'isOnTrial' => ($subscription['status'] ?? false) === \Leaf\Billing\Subscription::STATUS_TRIAL,
137+
]);
138+
}
137139
}
138140
}
139141

0 commit comments

Comments
 (0)