~/talk

Advanced Querying with Laravel Eloquent

Talkat Laracon Online Winter 2018 · on Wednesday, 2018-02-07· [php, databases]
speakerdeck:reinink
slides:none on file

Builds a one‑page LaraCRM demo around 1,000 customers with 500,000 interactions to show real pain from N+1 and heavy memory use. Shows concrete fixes: replace per‑row queries with subselects and scopes, add an Eloquent macro for cleaner subqueries, convert subselects to casts or a hasOne via last_interaction_id, and use orderByRaw for birthday sorting. Demonstrates filters and a visibleTo scope for policy logic in SQL, reaching 3 queries / ~3MB / ~40ms per page.

AI-written summary · about

  1. 0:00Intro
  2. 8:30The Bigger Lesson
  3. 10:44The Code
  4. 11:25The Data
  5. 13:04Base Setup
  6. 14:06Requirements
  7. 15:03Adding a Scope
  8. 15:51Adding a Company
  9. 17:21Adding a Last Interaction
  10. 20:25Adding a Query Builder
  11. 23:03Sub Query
  12. 24:36Last Interaction Date
  13. 26:37Improve Last Interaction Date
  14. 28:23Add Last Interaction Type
  15. 29:31Add Last Interaction
  16. 31:35Performance
  17. 32:41What Next
  18. 34:38The Scope
  19. 35:09The Implementation
  20. 38:12Birthdays
  21. 41:13Interaction Dates
  22. 42:15Filtering
  23. 45:10Filter Scope
  24. 49:49Re Implement Policies
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 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
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
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.