feat: add admin env badge, quick post button, and harden plugin enable
Build and Deploy / verify (push) Failing after 15m17s
Build and Deploy / deploy (push) Skipped

Show local/prod in the Filament topbar, jump to create post in one click, tighten sidebar spacing, and stop Hello World from 500ing when its tables are missing.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
gouki
2026-09-18 08:24:16 +00:00
co-authored by Cursor
parent b39423831c
commit 469160dc3f
19 changed files with 825 additions and 43 deletions
+13 -11
View File
@@ -28,8 +28,10 @@ plugins/{vendor}.{name}/ # 目录名必须 vendor.name 格式(如 dem
"author": "你的名字",
"type": "demo",
"provider": "Plugins\\Demo\\HelloWorld\\ServiceProvider",
"requires": ["neatstudio.payment"], // 可选:依赖的插件
"filament_pages": ["Plugins\\Demo\\HelloWorld\\Filament\\Pages\\HelloWorldSettings"],
"requires": ["neatstudio.payment"], // 可选:依赖的插件
"filament_pages": [
"Plugins\\Demo\\HelloWorld\\Filament\\Pages\\HelloWorldSettings"
],
"filament_resources": ["...\\Resources\\XxxResource"]
}
```
@@ -74,14 +76,14 @@ class ServiceProvider extends PluginServiceProvider
### 常用钩子
| Hook | 类型 | 参数 | 用途 |
|------|------|------|------|
| `post.rendered` | filter | `(string $html, Post) : string` | 文章渲染后处理(短代码/付费过滤) |
| `comment.created` | action | `Comment` | 新评论创建 |
| `payment.paid` | action | `Payment` | 支付成功(按 `$payment->payable` 分发) |
| `filament.post_form` | action | `Schema` | 文章编辑表单追加字段 |
| `filament.post_table` | action | `Table` | 文章列表追加列 |
| `seo.structured_data` | filter | `(array $data) : array` | 扩展 JSON-LD |
| Hook | 类型 | 参数 | 用途 |
| --------------------- | ------ | ------------------------------- | --------------------------------------- |
| `post.rendered` | filter | `(string $html, Post) : string` | 文章渲染后处理(短代码/付费过滤) |
| `comment.created` | action | `Comment` | 新评论创建 |
| `payment.paid` | action | `Payment` | 支付成功(按 `$payment->payable` 分发) |
| `filament.post_form` | action | `Schema` | 文章编辑表单追加字段 |
| `filament.post_table` | action | `Table` | 文章列表追加列 |
| `seo.structured_data` | filter | `(array $data) : array` | 扩展 JSON-LD |
完整列表见 `docs/plugins.md`。
@@ -119,7 +121,7 @@ return view('demo-hello::hello', compact('logs'));
## 6. 迁移 + 模型
迁移放在 `database/migrations/`,**无需手动 --path**,`php artisan migrate` 自动执行(AppServiceProvider 已注册 `plugins/*/database/migrations`)。
迁移放在 `database/migrations/`,**无需手动 --path**,`php artisan migrate` 自动执行(AppServiceProvider 已注册 `plugins/*/database/migrations`)。后台启用插件时也会再跑一次该插件自己的迁移。
模型照常写,命名空间 `Plugins\Demo\HelloWorld\Models`。