What Are Routes in Laravel?
Routes are the entry points that tell Laravel what to do when a URL is visited.
For example:
When someone visits http://your-app.test/hello, Laravel will return "Hello, World!".
Laravel Route File Location
All web routes are typically defined in:
This is where you handle browser-based routes (frontend). For APIs, you use
routes/api.php.
Basic Route Types
1. GET Route
Used when retrieving data or showing a page.
2. POST Route
Used to submit form data (like uploading a file or submitting a login form):
3. PUT / PATCH Route
Used to update data.
4. DELETE Route
Used to delete something.
Route with Controller
Instead of putting logic directly inside the route, Laravel allows mapping routes to a controller method.
In PageController.php:
Naming Routes
You can name a route using ->name() so that you can reference it elsewhere (like in a form).
Usage in Blade:
Route Parameters
1. Required Parameter:
Visiting /user/10 returns User ID is: 10.
2. Optional Parameter:
Route List
You can see all registered routes using:
It will show you:
-
Method (GET, POST, etc.)
-
URI
-
Controller
-
Name
-
Middleware
Example: Simple Laravel Form Routes Setup
Summary Table
| Method | Usage | Example |
|---|---|---|
| GET | Read data / show page | Route::get('/home', ...) |
| POST | Submit data | Route::post('/form', ...) |
| PUT | Update data | Route::put('/profile', ...) |
| DELETE | Delete data | Route::delete('/post', ...) |
| ANY | Accept any method | Route::any('/anything', ...) |
| MATCH | Accept specific methods | Route::match(['get', 'post'], ...) |
Want to explore route groups, middleware, or resource routes next?

