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

This commit is contained in:
Paulo Castellano 2026-05-14 19:59:50 -03:00
parent fc90861a96
commit d71df05291
2 changed files with 2 additions and 9 deletions

View file

@ -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([

View file

@ -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);