laracon2017

  • 所有者: adamwathan/laracon2017
  • 平台:
  • 許可證:
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Cruddy by Design

During my talk at Laracon 2017, I shared some strategies I use to split large controllers into multiple small controllers.

The core idea is to try and stick to the 7 standard REST/CRUD actions in your controllers:

  • Index
  • Show
  • Create
  • Store
  • Edit
  • Update
  • Destroy

Using this convention as a "rule" is a good way to force yourself to keep your controllers from becoming bloated, and can often lead to learning interesting new things about your domain.

For the presentation, I put together a demo app called "CastHacker" that showcases podcasts about software development. It's not a "real" app by any means (lots of imaginary features, no tests, etc.); it's just enough code to demonstrate the concepts from the presentation. Feel free to clone it and play with it locally if you like though.

I've written up each refactoring I shared in the presentation as a detailed pull request:

  1. Give nested resources a dedicated controller

  2. Treat properties edited independently as separate resources

  3. Treat pivot models as their own resource

  4. Think of different states as different resources

主要指標

概覽
名稱與所有者adamwathan/laracon2017
主編程語言PHP
編程語言PHP (語言數: 3)
平台
許可證
所有者活动
創建於2017-08-02 19:04:15
推送於2018-02-08 18:45:52
最后一次提交2018-02-08 13:45:30
發布數0
用户参与
星數495
關注者數18
派生數81
提交數16
已啟用問題?
問題數5
打開的問題數3
拉請求數5
打開的拉請求數0
關閉的拉請求數3
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?