From d71df052913c990833ddb6c76753296ca7fd0f06 Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Thu, 14 May 2026 19:59:50 -0300 Subject: [PATCH] refactor: inline plan_id and trial_ends_at in CreateUser + drop docblock on activeTrialEndsAt --- app/Actions/User/CreateUser.php | 7 ++----- app/Models/Account.php | 4 ---- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/app/Actions/User/CreateUser.php b/app/Actions/User/CreateUser.php index 299c6de2..5094f2cf 100644 --- a/app/Actions/User/CreateUser.php +++ b/app/Actions/User/CreateUser.php @@ -23,14 +23,11 @@ public static function execute(array $data, array $utmParameters = []): User $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 79f696d1..57934b19 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -91,10 +91,6 @@ public function isOnTrial(): bool 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);