~/talk

Expressive Eloquent collections

Talkat Laracon AU 2019 · on Thursday, 2019-10-31· [php]
slides:none on file

Builds concrete expressive collections by creating a model-specific collection class and wiring it via newCollection on model, so queries return an InvoiceCollection extends EloquentCollection that carries domain methods like isPaid, totalCost, sortByRelevance and a query-target helper that does one DB update then patches in-memory models. Uses Laravel higher-order collection proxies, Carbon for dates and custom query builders. Result is thinner models, extracted repeated logic, easier unit testing and fewer queries — pattern proves practical in real projects.

AI-written summary · about

  1. 0:00Intro
  2. 1:28Expressive Eloquent Collections What is eloquent?
  3. 3:54Why I wanted to improve readability
  4. 4:19The language of a model Problem space specific
  5. 7:31The language of a collection Set of generic items.
  6. 12:23Just the beginning
  7. 12:56Extracting repeated logic Keepin' it DRY
  8. 13:40Default and improved sorting methods
  9. 15:40Thinning models
  10. 19:04Testability
  11. 22:08Sharing a filtering API with eloquent scopes
  12. 24:05Encapsulation
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.