Community编程与开发github.com

Taldres/laravel-waitlist

使用 taldres/laravel-waitlist 构建候补名单统计:每日注册和确认数(用于图表)、周期总计和确认率、任意过去日期的确认人数,以及当前列表人数,适用于仪表盘、管理页面和 API 端点。

laravel-waitlist 是什么?

该技能基于 `taldres/laravel-waitlist` 包,为 Laravel 应用提供候补名单(Waitlist)的报告和统计能力。它能精确区分“过去发生了什么”(活动日志)和“现在谁在列表里”(快照),从而避免常见的统计错误——比如将已离开的人员计入当前列表人数。技能覆盖了快照查询(待确认、已确认、已退订等状态)、周期总计(注册数、确认数、退订数、确认率、净变化),以及过去某一天的确认人数。所有报告都按应用时区分组到天,支持按项目、列表甚至可选目的(purpose)进行范围限定,并内置了每日序列(带间隙填充)用于图表展示。该技能在 Claude Code、Cursor 等 AI 编码助手中使用,能够指导开发者快速构建准确的候补名单仪表盘、管理面板或 API 端点,避免常见的反模式(如直接统计数据库行数)。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Taldres/laravel-waitlist/tree/HEAD/resources/boost/skills/laravel-waitlist-reporting

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Laravel Waitlist:报告

当使用 taldres/laravel-waitlist 的应用需要关于其候补名单的数字时使用此技能:仪表盘、图表、管理小部件、周报。

主要目标

  • 从正确的来源回答每个问题:活动日志用于“发生了什么”,snapshot() 用于“现在谁在列表里”

工作流程

1. 选择来源

Waitlist::for('beta')->report()->between('2026-08-01', '2026-08-31')->totals();
// "2026年8月已确认230人":活动日志,关于过去的事实

Waitlist::for('beta')->snapshot();
// "当前列表有197人":地址,关于现在的事实

后续的擦除永远不会改变第一个数字。计数是步骤,而不是人:离开又回来的人会被确认两次。

2. 当前:snapshot()

$snapshot = Waitlist::for('beta')->snapshot();

$snapshot->pending;       // 等待确认中
$snapshot->confirmed;     // 已在列表上
$snapshot->unsubscribed;  // 已离开,仍在保留期内
$snapshot->active();      // pending + confirmed
$snapshot->total();
$snapshot->toArray();     // 可转为 JSON,包含项目和列表

3. 一个周期:总计

use Taldres\Waitlist\Enums\ActivityType;
use Taldres\Waitlist\Enums\EntryStatus;

$totals = Waitlist::for('beta')->report()->since(30)->totals();   // 最近30天

$totals->signups();                       // 订阅 + 重新订阅
$totals->of(ActivityType::Confirmed);
$totals->of(ActivityType::Unsubscribed, from: EntryStatus::Confirmed);  // 确认后离开
$totals->confirmationRate();              // ?float,无人注册时为 null
$totals->confirmedChange();               // 确认人数的净变化

4. 图表:每日序列

$series = Waitlist::for('beta')->report()->since(30)->daily()->fillGaps();

foreach ($series as $day) {
    $day->date;                       // CarbonImmutable
    $day->signups();
    $day->of(ActivityType::Confirmed);
}

$series->toArray();   // [{date, subscribed, resubscribed, confirmation_requested, confirmation_mailed, confirmed, unsubscribed, expired, erased, consent_granted, consent_withdrawn}]

fillGaps() 添加没有活动的天数,图表需要这个。

5. 过去某一天的确认人数

Waitlist::for('beta')->report()->confirmedOn('2026-09-30');   // 当天结束时

精确性取决于日志的回溯范围,精确到天。今天的值等于 snapshot()->confirmed。

6. 范围

  • Waitlist::report():默认项目的所有列表;->forList('beta', 'launch') 可缩小范围。
  • Waitlist::for('beta')->report():一个列表。
  • Waitlist::project('acme')->report():一个项目;Waitlist::allProjects()->report():全部。
  • ->forPurpose('newsletter'):仅针对可选目的的授予和撤销;注册、确认和离开不携带目的,会被排除。
  • 没有 since() 或 between() 时,返回所有存储的数据。

规则、参考和模板

  • 一天始终以 app.timezone 结束:每行在写入时存储其日期 (occurred_on),报告按该日期分组并在该时区解析周期。擦除会清除精确时间,因此在首次注册前设置 app.timezone;之后更改它不会重新日期化已有的行,只影响后续行。使用 UTC 时,柏林夏季 23:30 的注册属于下一个 UTC 日:这是一个明确的边界,而不是计数错误。
  • 报告是一个分组的查询;如果仪表盘频繁轮询,可以在应用中缓存它们。
  • 保持的日志是最小的,而不是匿名的:为需要的人保留报告。
  • 指南:https://github.com/Taldres/laravel-waitlist/blob/main/docs/reporting.md

示例

  • “在管理面板中显示上个月的每日注册数”:步骤 4 作为 JSON 提供给图表库。
  • “每个月底我们有多少已确认的人数?”:每月末调用 confirmedOn()。
  • “本周 Beta 列表的转化率”:report()->since(7)->totals()->confirmationRate()。

反模式

  • 对过去周期统计 WaitlistEntry 行数;擦除和保留期会改变它们。
  • 把 Waitlist::for($list)->count() 当作“列表上的人数”:它包含已离开的人;应使用 snapshot()->confirmed 或 active()。
  • 使用特定于数据库引擎的函数计算日期;日志已经存储了报告日期。
  • 期望按目的过滤的报告包含注册或确认数。

Individual skills in this repo

This repo contains 13 individual skills — each has its own dedicated page.

Taldres/laravel-waitlist

Use this skill when reviewing Laravel package compatibility across composer constraints, PHP versions, Laravel versions, Testbench versions, dependency stability lanes, Windows CI, or matrix-sensitive code and workflow changes.

Taldres/laravel-waitlist

Use this skill when creating or updating the bundled Laravel Boost skill under resources/boost/skills from the package implementation and package documentation. Trigger after public APIs, commands, config, routes, views, publish tags, README content, or examples change.

Taldres/laravel-waitlist

Use this skill when preparing Laravel package releases: CHANGELOG.md updates, generated release notes, GitHub release workflows, version checks, tags, release validation, or release automation changes. Never publish autonomously.

Taldres/laravel-waitlist

Use this skill when adding Laravel package capabilities or wiring them through the service provider: commands, migrations, routes, config merges, views, translations, assets, middleware, publish tags, workbench files, or console-only behavior.

Taldres/laravel-waitlist

Use this skill when writing, editing, fixing, or reviewing package tests with Pest 4/5 and Orchestra Testbench, including TDD, feature tests, unit tests, type coverage, arch tests, workbench behavior, commands, routes, config, migrations, and publishable resources.

Taldres/laravel-waitlist

Integrate taldres/laravel-waitlist in a Laravel application: define purposes, lists and fields, build the signup form, send the confirmation mail from events, add a preference page, and keep consent, retention and encryption intact.

Taldres/laravel-waitlist

Build the pages of a taldres/laravel-waitlist integration: the signup form with the registered wording, and the confirm, unsubscribe and preference pages, either in Laravel controllers (Blade, Livewire, Inertia) or in an SPA or static site over the package's JSON API, including CORS and bot protection.

Taldres/laravel-waitlist

Turn a taldres/laravel-waitlist waitlist into a launch: invite people in batches in signup order, let invited addresses register, announce the launch to everyone who agreed, and erase the list once its purpose is fulfilled.

Taldres/laravel-waitlist

Send the mails of a taldres/laravel-waitlist integration: the double opt-in confirmation, the preference page link, a welcome mail, launch mails and newsletters to the people who agreed, with the right unsubscribe links, one-click headers and a sender per project.

Taldres/laravel-waitlist

Operate a taldres/laravel-waitlist installation: answer access and erasure requests, withdraw a purpose on request, apply retention, erase a list once its purpose is fulfilled, rotate APP_KEY with waitlist:rekey, export a list, and check the setup before going live.

Taldres/laravel-waitlist

Run the waitlists of several products in one Laravel app with taldres/laravel-waitlist projects: define projects, scope facade calls with project(), resolve the project of HTTP signups, send mail per project, handle requests across all projects, or keep projects in a database for a central waitlist API.

Taldres/laravel-waitlist

Keep a newsletter tool such as Brevo, Mailchimp or Mailcoach in step with a taldres/laravel-waitlist waitlist: add confirmed contacts per purpose, remove them on withdrawal and erasure, and carry unsubscribes made at the provider back into the waitlist via a webhook.

Taldres/laravel-waitlist

Write feature tests for an application's taldres/laravel-waitlist integration: get the plain tokens from events, assert the confirmation and other mails, test the signup, confirm and unsubscribe flows in PHP and over the package's HTTP routes, and bypass rate limits and bot checks in tests.

相关技能