Laravel Codehappy Es Libre
Desarrollo de aplicaciones con el Framework de PHP
Laravel para principiantes.
Dayle Rees and Antonio Laguna
This book is for sale at http://leanpub.com/codehappy-es
This version was published on 2013-02-06
This is a Leanpub book. Leanpub empowers authors and publishers with the Lean Publishing
process. Lean Publishing is the act of publishing an in-progress ebook usinglightweight tools
and many iterations to get reader feedback, pivot until you have the right book and build
traction once you do.
©2012 - 2013 Dayle Rees.
Tweet This Book!
Please help Dayle Rees and Antonio Laguna by spreading the word about this book on Twitter!
The suggested hashtag for this book is #codehappy.
Find out what other people are saying about the book by clicking on this link tosearch for this
hashtag on Twitter:
https://twitter.com/search/#codehappy
Índice general
Reconocimiento
Reconocimientos del traductor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
i
i
Erratas
ii
Feedback
iii
Introducción
iv
1
2
3
4
Comenzando
1
1.1
Método 1 Crea un nuevo host virtual . . . . . . . . . . . . . . . . . . . . . . . .
1
1.2
Método 2 Enlace simbólicoa la carpeta pública . . . . . . . . . . . . . . . . . .
2
1.3
Centrándonos de nuevo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3
Estructura de proyectos
4
2.1
Estructura del directorio raíz . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4
2.2
Estructura del directorio Application . . . . . . . . . . . . . . . . . . . . . . . .
5
Usando controladores
83.1
Enrutando controladores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
3.2
Pasando parámetros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10
3.3
Usando vistas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10
3.4
Controladores RESTful . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12
3.5
Elcontrolador base, Base_Controller . . . . . . . . . . . . . . . . . . . . . . . .
13
3.6
Enrutamiento avanzado . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13
Rutas con closures
15
4.1
Closures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15
4.2
Redirecciones y rutas con nombre . . . . . . . . . . . . . . . . . . . . . . . . . .
16
4.3
Filtros. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
4.4
Grupos de rutas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
⁴NDICE GENERAL
5
6
7
8
9
Enlaces y URLs
20
5.1
Obteniendo URLs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
5.2
Generando enlaces . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . .
23
Formularios
25
6.1
Creando formularios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25
6.2
Añadiendo etiquetas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26
6.3
Generando campos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27
6.4
Generando botones . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . .
28
6.5
Campos secretos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
6.6
Token CSRF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
6.7
Macros de formulario . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
Gestionando la entrada de datos
30
7.1
Datos de peticiones . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . .
30
7.2
Archivos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
7.3
Datos flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
Validación
34
8.1
Estableciendo una validación . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
8.2
Errores . . . . . . . . . . . . . . . ....
Regístrate para leer el documento completo.