Laravel 13 cheatsheet

Laravel 13: Controllers and routes

6 common Laravel 13 tasks.

Create a controller

Generate a controller in app/Http/Controllers.

php artisan make:controller PostController

Create a resource controller

Generate a controller with the conventional CRUD methods.

php artisan make:controller PostController --resource

Create an API resource controller

Generate CRUD methods for an API without HTML form actions.

php artisan make:controller PostController --api

List registered routes

Inspect methods, paths, names and actions registered by the application.

php artisan route:list

Create middleware

Generate middleware to inspect or filter incoming requests.

php artisan make:middleware EnsureUserIsAdmin

Create a form request

Generate a form request class for validation and authorization.

php artisan make:request StorePostRequest

Was this page helpful?