Skip to content

Commit 1258b2c

Browse files
committed
fix: argument #1 ($plan) must be of type string, null given, in MobilePricing::createCheckoutSession()
1 parent dd1f850 commit 1258b2c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

app/Livewire/MobilePricing.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,15 @@ public function handlePurchaseRequest(array $data)
2424
return $this->createCheckoutSession($data['plan'], $user);
2525
}
2626

27-
public function createCheckoutSession(string $plan, ?User $user = null)
27+
public function createCheckoutSession(?string $plan, ?User $user = null)
2828
{
29+
// This method is somehow getting called without a plan being passed in.
30+
// Not sure how (probably folks hacking or a bot thing),
31+
// but we will just return early when this happens.
32+
if (! $plan) {
33+
return;
34+
}
35+
2936
// If a user isn't passed into this method, Livewire will instantiate
3037
// a new User. So we need to check that the user exists before using it,
3138
// and then use the authenticated user as a fallback.

0 commit comments

Comments
 (0)