Skip to content

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.

refactor: inline plan_id and trial_ends_at in CreateUser + drop docblock on activeTrialEndsAt

Paulo Castellanod71df052913c
diff --git a/app/Actions/User/CreateUser.php b/app/Actions/User/CreateUser.php
index 299c6de20..5094f2cf8 100644
--- a/app/Actions/User/CreateUser.php
+++ b/app/Actions/User/CreateUser.php
@@ -23,14 +23,11 @@ class CreateUser
$user = DB::transaction(function () use ($data, $utmParameters): User {
$isInviteRegistration = data_get($data, 'is_invite', false);
- $starterPlanId = Plan::where('slug', Slug::Starter)->value('id');
- $trialEndsAt = now()->addDays(config('cashier.trial_days', 7));
-
$account = Account::create([
'name' => data_get($data, 'name')."'s Account",
'billing_email' => data_get($data, 'email'),
- 'plan_id' => $starterPlanId,
- 'trial_ends_at' => $trialEndsAt,
+ 'plan_id' => Plan::where('slug', Slug::Starter)->value('id'),
+ 'trial_ends_at' => now()->addDays(config('cashier.trial_days', 7)),
]);
$user = User::create(array_merge([
diff --git a/app/Models/Account.php b/app/Models/Account.php
index 79f696d17..57934b192 100644
--- a/app/Models/Account.php
+++ b/app/Models/Account.php
@@ -91,10 +91,6 @@ class Account extends Model
return (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);