refactor: Simplify code for retrieving subscription in Stripe webhook
This commit is contained in:
parent
920305432b
commit
38d9999814
@ -67,11 +67,11 @@ public function events(Request $request)
|
|||||||
$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');
|
||||||
|
Loading…
Reference in New Issue
Block a user