Skip to content
academia.sh

Unit 02 of 03

Views and Data

The template engine, forms and validation, object–table binding, relationships, migrations and seeding, pagination and resource transformation — each as a mechanism that decides whether a record, a rule or a field takes part in this request.

Published Updated

Lessons

  1. 01 The Template Engine A template compiler with layouts, components and loops is built; the lesson measures that escaping runs on every output, that compilation is skipped for an unchanged template, and that escaping is not wired on raw output. 3 min read
  2. 02 Forms and Validation A validator that works with rule strings is built; the lesson measures that the save step is skipped on invalid input, runs on valid input, and that stopping at the first error skips the next rule. 2 min read
  3. 03 Object–Table Binding A small model class that keeps the table as a PHP array is built; the lesson measures that the save hook runs on save, that a field outside the allow list is not wired in mass assignment, and that the hook is not wired in a bulk update. 2 min read
  4. 04 Relationships One-to-one, one-to-many and many-to-many relationships are built in a small model; the lesson measures that with lazy loading the relationship query is deferred until access, that with eager loading it runs together with the list, and that a relationship never accessed stays deferred. 2 min read
  5. 05 Migrations and Seeding Migrations that version the schema and a seeder that writes starting data are built; the lesson measures that a recorded migration is skipped on the second run, that a new migration runs, and that editing a migration file that has already run is not wired. 1 min read
  6. 06 Pagination and Resource Transformation Offset pagination and a resource transformation from model to response array are built; the lesson measures that a new column added to the model is not wired to the response because it is not in the transformation definition, that it runs once added to the definition, and that a request outside the page range returns an empty list. 2 min read

Start typing to search.

↑↓ ↵ Esc navigate · open · close