Cmd/Ctrl + K

Build a CRUD resource

This recipe creates a simple posts resource with a migration, model, controller, routes, validation, and PHP views.

Migration

Generate a migration, define the resource table, and apply it to the database.

Run it:

Model

Generate the model and declare the attributes that may be filled from input.

Controller

Generate a controller that implements the resource operations and validates writes.

Routes

Connect each HTTP operation to its corresponding controller method.

Use controller handlers so the routes can be cached in production.