Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
refactor(account): move trial-end-date logic into Account::activeTrialEndsAt()
Paulo Castellanofc90861a966c
diff --git a/app/Http/Controllers/App/BillingController.php b/app/Http/Controllers/App/BillingController.phpindex 07eda9785..92e007444 100644--- a/app/Http/Controllers/App/BillingController.php+++ b/app/Http/Controllers/App/BillingController.php@@ -139,7 +139,7 @@ class BillingController extends Controllerreturn Inertia::render('settings/account/Billing', ['hasSubscription' => $account->subscribed(Account::SUBSCRIPTION_NAME),'onTrial' => $account->isOnTrial(),- 'trialEndsAt' => $subscription?->trial_ends_at ?? $account->trial_ends_at,+ 'trialEndsAt' => $account->activeTrialEndsAt(),'subscription' => $subscription?->only(['stripe_status','ends_at',diff --git a/app/Models/Account.php b/app/Models/Account.phpindex 50d49565a..79f696d17 100644--- a/app/Models/Account.php+++ b/app/Models/Account.php@@ -9,6 +9,7 @@ use App\Features\MonthlyCreditsLimit;use App\Features\SocialAccountLimit;use App\Features\WorkspaceLimit;use App\Models\Traits\HasUsage;+use Carbon\CarbonInterface;use Database\Factories\AccountFactory;use Illuminate\Database\Eloquent\Concerns\HasUuids;use Illuminate\Database\Eloquent\Factories\HasFactory;@@ -90,6 +91,21 @@ class Account extends Modelreturn (bool) $this->subscription(self::SUBSCRIPTION_NAME)?->onTrial();}+ /**+ * The end date of whichever trial is currently active (subscription trial+ * or generic trial), or null if the account is not on any trial.+ */+ public function activeTrialEndsAt(): ?CarbonInterface+ {+ $subscription = $this->subscription(self::SUBSCRIPTION_NAME);++ return match (true) {+ (bool) $subscription?->onTrial() => $subscription->trial_ends_at,+ $this->onGenericTrial() => $this->trial_ends_at,+ default => null,+ };+ }+/*** Returns the displayable card for the billing UI. Falls back to the first* attached payment method when the customer has no `invoice_settings.default_payment_method`