Files
lotteryLaravel/AGENTS.md
kang e4118d7b1d feat: 更新后台 RBAC 文档与权限检查逻辑
- 在 `AGENTS.md` 中新增后台 RBAC 相关说明,强调 `php artisan lottery:admin-auth-sync --audit` 的使用。
- 更新 `README.md`,明确本地重置演示数据的命令,并补充 `AdminAuthorizationRegistry` 的同步要求。
- 精简 `AdminDashboardAnalyticsBuilder` 中的权限检查逻辑,确保与 `AdminAuthorizationRegistry` 一致。
- 在 `admin-rbac.md` 中添加仪表盘 API 权限要求的详细信息,优化维护命令的描述。
2026-05-26 13:59:28 +08:00

22 lines
934 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# lotterLaravel — Agent 须知
## 数据库:禁止擅自清空
**未经用户明确同意,不得执行:**
| 禁止 | 说明 |
|------|------|
| `php artisan migrate:fresh` | 删表重建,业务数据全失 |
| `php artisan db:wipe` | 清空所有表 |
| `php -r` / 脚本中的 `migrate:fresh``db:wipe` | 易误连 `.env` 开发库(如 `pgsql` / `lottery` |
**可以做的:** `php artisan migrate`(增量)、`php artisan test`(走 `phpunit.xml` 的 SQLite 内存库)。
用户明确要求 `migrate:fresh` 时:先说明目标库名与数据将全部丢失,待用户确认后再执行。
详见 `.cursor/rules/database-destructive-commands.mdc`
## 后台 RBAC
`app/Support/AdminAuthorizationRegistry.php` 后,在已有库执行 `php artisan lottery:admin-auth-sync --audit`(见 `docs/admin-rbac.md`)。`migrate:fresh --seed` 会走迁移内的 resync一般不必再手动 sync。