startOfMonth(); return array_merge(Subscription::snapshotFrom('team'), [ 'customer_id' => Customer::factory(), 'started_at' => $start, 'current_period_start' => $start, 'current_period_end' => $start->copy()->addMonth(), 'status' => 'active', ]); } public function plan(string $plan, string $term = Subscription::TERM_MONTHLY): static { return $this->state(function () use ($plan, $term) { $start = now()->startOfMonth(); return array_merge(Subscription::snapshotFrom($plan, $term), [ 'current_period_start' => $start, 'current_period_end' => $term === Subscription::TERM_YEARLY ? $start->copy()->addYear() : $start->copy()->addMonth(), ]); }); } }