fix(09): WR-09 scaffold admin controllers with a required permission and a record source placeholder

This commit is contained in:
Jakub Zych
2026-10-01 21:13:40 +02:00
parent 8b48eea4e1
commit 20a79c5df4
5 changed files with 29 additions and 2 deletions

View File

@@ -154,7 +154,7 @@ func (p *BlogPlugin) Settings() []pact.SettingsItem {
summer make:admin-controller acme.blog Posts
```
The controller ID maps to the admin API path: `acme.blog.posts` is served under `<prefix>/api/v1/acme/blog/posts`. The admin prefix is `backend.uri`, `/backend` by default. A model's `Fillable` method decides which form fields the API may write; see [Forms](forms.md).
The generated controller requires the permission `acme.blog.access_posts`, so declare it in the plugin's `pact.HasPermissions` or the admin API refuses to start with an unknown-permission error. Its `NewRecord` returns `nil` until you return the model, and the list and every write answer 500 until then. The controller ID maps to the admin API path: `acme.blog.posts` is served under `<prefix>/api/v1/acme/blog/posts`. The admin prefix is `backend.uri`, `/backend` by default. A model's `Fillable` method decides which form fields the API may write; see [Forms](forms.md).
## Compilation at boot