Overview
Macuin’s routes are defined inroutes/web.php. All routes return Blade views and use named routes for easy reference throughout the application. Currently, the application uses closure-based routes for simplicity.
Route Configuration
Routes are defined using Laravel’sRoute facade:
routes/web.php
Route List
Homepage
GET /
Route Name:
View:
Description: Main landing page of the application
indexView:
home.indexDescription: Main landing page of the application
Catalog
GET /catalogo
Route Name:
View:
Description: Product catalog page displaying automotive parts
catalogoView:
catalogos.catalogoDescription: Product catalog page displaying automotive parts
Authentication
GET /registro
Route Name:
View:
Description: User registration page
registroView:
auth.registroDescription: User registration page
GET /login
Route Name:
View:
Description: User login page
loginView:
auth.loginDescription: User login page
Shopping Cart
GET /carrito
Route Name:
View:
Description: Shopping cart page for reviewing items before checkout
carritoView:
carrito.carritoDescription: Shopping cart page for reviewing items before checkout
Orders
GET /pedidos
Route Name:
View:
Description: Order list page
pedidosView:
pedidos.pedidoDescription: Order list page
GET /pedido-detalle/{id}
Route Name:
View:
Description: Order details page
pedido-detalleView:
pedidos.pedido-detalleDescription: Order details page
The order details route accepts an
{id} parameter that is passed to the view for displaying specific order information.Named Routes
All routes use the->name() method to assign a name. Named routes allow you to generate URLs or redirects without hardcoding the path:
Generating URLs
In Blade Templates
In Controllers
Route Parameters
The application currently uses one route parameter:Order ID Parameter
- Parameter:
{id}- The order identifier - Type: String (no constraint defined)
- Usage: Passed to the view for displaying order details
Route parameters are automatically dependency-injected into the route closure or controller method.
URL Structure
Macuin uses clean, SEO-friendly URLs:| URL | Purpose | Spanish Translation |
|---|---|---|
/ | Homepage | Inicio |
/catalogo | Product catalog | Catálogo |
/registro | Registration | Registro |
/login | Login | Iniciar sesión |
/carrito | Shopping cart | Carrito |
/pedidos | Orders list | Pedidos |
/pedido-detalle/{id} | Order details | Detalle del pedido |
URL paths use Spanish terms to match the application’s primary language.
Route Groups and Middleware
Currently, the application does not use route groups or middleware. As the application grows, you can organize routes using:Middleware Groups
Route Prefixes
Testing Routes
You can view all registered routes using the Artisan command:Best Practices
Use Named Routes
Always use
->name() to name your routes. This makes refactoring URLs easier.RESTful Conventions
Follow REST conventions for resource routes (GET, POST, PUT, DELETE).
Route Parameters
Use route parameters instead of query strings for resource identifiers.
Organize with Groups
Use route groups to apply middleware and prefixes to multiple routes.
Future Considerations
As the application evolves, consider:
- Moving route logic to dedicated controllers
- Adding authentication middleware for protected routes
- Implementing route model binding for automatic model injection
- Adding API routes in
routes/api.phpfor AJAX/SPA functionality - Implementing rate limiting for public-facing routes
Related Documentation
- Project Structure - Understanding the application architecture
- Database - Database schema and models