mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-18 07:20:50 +00:00
refactor: replace queries with cached versions for performance improvements
This commit is contained in:
@@ -5,39 +5,44 @@ use Stripe\Stripe;
|
||||
|
||||
function isSubscriptionActive()
|
||||
{
|
||||
if (! isCloud()) {
|
||||
return false;
|
||||
}
|
||||
$team = currentTeam();
|
||||
if (! $team) {
|
||||
return false;
|
||||
}
|
||||
$subscription = $team?->subscription;
|
||||
return once(function () {
|
||||
if (! isCloud()) {
|
||||
return false;
|
||||
}
|
||||
$team = currentTeam();
|
||||
if (! $team) {
|
||||
return false;
|
||||
}
|
||||
$subscription = $team?->subscription;
|
||||
|
||||
if (is_null($subscription)) {
|
||||
return false;
|
||||
}
|
||||
if (isStripe()) {
|
||||
return $subscription->stripe_invoice_paid === true;
|
||||
}
|
||||
if (is_null($subscription)) {
|
||||
return false;
|
||||
}
|
||||
if (isStripe()) {
|
||||
return $subscription->stripe_invoice_paid === true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
function isSubscriptionOnGracePeriod()
|
||||
{
|
||||
$team = currentTeam();
|
||||
if (! $team) {
|
||||
return false;
|
||||
}
|
||||
$subscription = $team?->subscription;
|
||||
if (! $subscription) {
|
||||
return false;
|
||||
}
|
||||
if (isStripe()) {
|
||||
return $subscription->stripe_cancel_at_period_end;
|
||||
}
|
||||
return once(function () {
|
||||
$team = currentTeam();
|
||||
if (! $team) {
|
||||
return false;
|
||||
}
|
||||
$subscription = $team?->subscription;
|
||||
if (! $subscription) {
|
||||
return false;
|
||||
}
|
||||
if (isStripe()) {
|
||||
return $subscription->stripe_cancel_at_period_end;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
});
|
||||
}
|
||||
function subscriptionProvider()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user