plan = Plan::lockForUpdate()->find($planId); } public function haveCapacity(): bool { if ($this->plan->capacity_limit === 0) return true; $count = User::where('plan_id', $this->plan->plan_id)->count(); return $this->plan->capacity_limit - $count; } }