refactor: Simplify code for retrieving subscription in Stripe webhook
This commit is contained in:
@@ -67,11 +67,11 @@ class Stripe extends Controller
|
|||||||
$subscription = Subscription::where('stripe_customer_id', $customerId)->first();
|
$subscription = Subscription::where('stripe_customer_id', $customerId)->first();
|
||||||
if (! $subscription) {
|
if (! $subscription) {
|
||||||
Sleep::for(5)->seconds();
|
Sleep::for(5)->seconds();
|
||||||
$subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail();
|
$subscription = Subscription::where('stripe_customer_id', $customerId)->first();
|
||||||
}
|
}
|
||||||
if (! $subscription) {
|
if (! $subscription) {
|
||||||
Sleep::for(5)->seconds();
|
Sleep::for(5)->seconds();
|
||||||
$subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail();
|
$subscription = Subscription::where('stripe_customer_id', $customerId)->first();
|
||||||
}
|
}
|
||||||
if ($subscription) {
|
if ($subscription) {
|
||||||
$subscriptionId = data_get($subscription, 'stripe_subscription_id');
|
$subscriptionId = data_get($subscription, 'stripe_subscription_id');
|
||||||
|
|||||||
Reference in New Issue
Block a user