以 PostController 控制器的每個方法都有對應的請求方式、路由命名、URL、方法名和業務邏輯約定。
| HTTP請求方式 | URL | 控制器方法 | 路由命名 | 業務邏輯描述 |
|---|---|---|---|---|
| GET | post | index() | post.index | 展示所有文章 |
| GET | post/create | create() | post.create | 發布文章表單頁面 |
| POST | post | store() | post.store | 獲取表單提交數據並保存新文章 |
| GET | post/{id} | show() | post.show | 展示單個文章 |
| GET | post/{id}/edit | edit() | post.edit | 編輯文章表單頁面 |
| PUT | post/{id} | update() | post.update | 獲取編輯表單輸入並更新文章 |
| DELETE | post/{id} | destroy() | post.destroy | 刪除單個文章 |
