Split nested project route sections
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: project-route-structure
|
||||
description: "Always apply in this project when creating, moving, or refactoring Laravel route definitions in routes/*.php; changing route prefixes, names, middleware, scoped bindings, or route files; or adding frontend-facing endpoints that Wayfinder generates. Documents the KanbanGit route-file layout and grouping conventions."
|
||||
description: "Always apply in this project when creating, moving, or refactoring Laravel route definitions in routes/**/*.php; changing route prefixes, names, middleware, scoped bindings, or route files; or adding frontend-facing endpoints that Wayfinder generates. Documents the KanbanGit route-file layout and grouping conventions."
|
||||
---
|
||||
|
||||
# Project Route Structure
|
||||
@@ -9,7 +9,7 @@ description: "Always apply in this project when creating, moving, or refactoring
|
||||
|
||||
Activate this skill whenever work in this project changes:
|
||||
|
||||
- `routes/*.php`
|
||||
- `routes/**/*.php`
|
||||
- Route names, URI prefixes, middleware groups, scoped bindings, or controller route registrations
|
||||
- Frontend-facing endpoints that require regenerated Wayfinder output
|
||||
|
||||
@@ -18,10 +18,11 @@ Use this together with `laravel-best-practices`. Also activate `wayfinder-develo
|
||||
## Route Files
|
||||
|
||||
- `routes/web.php` is the web entry point only. Keep public shell routes here, such as `home` and `dashboard`, then require domain route files.
|
||||
- `routes/projects.php` owns all `projects.*` routes.
|
||||
- `routes/admin.php` owns all `admin.*` routes.
|
||||
- `routes/teams.php` owns all `teams.*` routes.
|
||||
- `routes/settings.php` owns account settings routes, but keeps their existing route names such as `profile.edit`, `security.edit`, and `git-connections.edit`.
|
||||
- `routes/web/projects.php` owns the main `projects.*` structure.
|
||||
- `routes/web/admin.php` owns all `admin.*` routes.
|
||||
- `routes/web/teams.php` owns all `teams.*` routes.
|
||||
- `routes/web/settings.php` owns account settings routes, but keeps their existing route names such as `profile.edit`, `security.edit`, and `git-connections.edit`.
|
||||
- `routes/web/project/*.php` contains larger nested project route sections that would make `routes/web/projects.php` too deeply indented.
|
||||
|
||||
Add a new route file only when a domain gets large enough to stand alone. Otherwise, extend the existing domain file.
|
||||
|
||||
@@ -32,6 +33,7 @@ Add a new route file only when a domain gets large enough to stand alone. Otherw
|
||||
- Keep public route names stable unless the user explicitly asks for a public interface change.
|
||||
- Keep route URIs stable when reorganizing route files; this kind of change should be structural.
|
||||
- Use `function (): void` for route group closures.
|
||||
- For large nested sections, keep the structural group in the parent file and `require` a child file from inside the group. For example, keep `Route::prefix('tickets')->name('tickets.')->group(...)` in `routes/web/projects.php`, then require `routes/web/project/tickets.php` inside it.
|
||||
|
||||
## Project Routes
|
||||
|
||||
@@ -46,7 +48,11 @@ Project routes should follow this shape:
|
||||
- Project delete: `can:access-admin`
|
||||
- `projects/{project}/permissions/...` must not be inside `Route::scopeBindings()`, because `Project` does not define `users()` or `teams()` child relationships.
|
||||
- Use `Route::scopeBindings()` only around nested project resources that should bind through project-owned relationships, such as tickets and project settings children.
|
||||
- Keep ticket subroutes grouped under `tickets.` and settings subroutes grouped under `settings.`.
|
||||
- Keep the outer `{project}` group in `routes/web/projects.php`; it is part of the main project structure.
|
||||
- Keep compact view routes, such as show, board, and backlog, directly in `routes/web/projects.php`.
|
||||
- Keep ticket subroutes grouped under `tickets.` in `routes/web/projects.php`, with the route contents in `routes/web/project/tickets.php`.
|
||||
- Keep settings subroutes grouped under `settings.` in `routes/web/projects.php`, with the route contents in `routes/web/project/settings.php`.
|
||||
- Split dense settings subsections further under `routes/web/project/settings/`, such as `board.php`, `metadata.php`, and `repositories.php`.
|
||||
|
||||
## Settings Routes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user