Community程式設計與開發github.com

Taldres/laravel-waitlist

建立等候名單統計資料:每日註冊與確認次數(適用於圖表)、指定期間總數與確認率、過去任何一天的確認人數,以及目前正在等候名單上的人數,適用於儀表板、管理頁面和 API 端點。

laravel-waitlist 是什麼?

此技能提供針對 `taldres/laravel-waitlist` 套件的完善報告功能,讓開發者能快速取得等候名單的關鍵數據。它支援多種平台(如 Laravel 應用程式中的儀表板、管理員小工具、API 端點),並區分「過去發生的事件」(透過活動日誌)與「目前名單狀態」(透過 `snapshot()` 方法)。主要功能包括:以每日為單位的系列資料(適合圖表庫使用)、指定期間的總數與確認率計算、查詢過去任何一天結束時的確認人數,以及靈活的範圍控制(可針對單一名單、專案或所有專案)。此技能也內建了最佳實務提醒,例如避免直接計算 `WaitlistEntry` 資料列、正確使用 `snapshot()` 來取得目前有效名單、以及理解時區設定對每日報表的影響。

相容平台~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();
// "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()。
  • 使用引擎特定的函數在 SQL 中計算日期;日誌已經儲存了報告日期。
  • 期望經過目的過濾的報告包含註冊或確認資料。

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.

相關技能