没有合适的资源?快使用搜索试试~ 我知道了~
Laravel Code Happy
5星 · 超过95%的资源 需积分: 11 18 下载量 90 浏览量
2013-07-14
00:12:45
上传
评论
收藏 2.28MB PDF 举报
温馨提示
试读
138页
Laravel是一套简洁、优雅的PHP Web开发框架;Laravel框架学习文档;
资源推荐
资源详情
资源评论
Laravel: Code Happy
Application development with the Laravel PHP
Framework for beginners.
©2012 Dayle Rees
This version was published on 2012-05-30
This is a Leanpub book, for sale at:
http://leanpub.com/codehappy
Leanpub helps authors to self-publish in-progress ebooks. We call this idea Lean Publishing. To
learn more about Lean Publishing, go to: http://leanpub.com/manifesto
To learn more about Leanpub, go to: http://leanpub.com
Contents
Acknowledgments i
Errata ii
Feedback iii
Introduction iv
1 Getting Started 1
1.1 Method 1 Create a new VirtualHost . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Method 2 Symbolic link the public folder. . . . . . . . . . . . . . . . . . . . . . 2
1.3 Getting back on track.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Project Structure 4
2.1 Root Directory Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Application Directory Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3 Using Controllers 8
3.1 Routing Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2 Passing Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.3 Using Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.4 RESTful Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.5 The Base_Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.6 Advanced Routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4 Routes With Closures 15
4.1 Closures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.2 Redirects and Named Routes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.3 Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.4 Route Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5 Links and URLs 20
5.1 Retrieving URLs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.2 Generating Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
i
CONTENTS ii
6 Forms 25
6.1 Creating Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.2 Adding Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.3 Generating Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.4 Generating Buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.5 Secret Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.6 CSRF Token . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.7 Form Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
7 Handling Input 30
7.1 Request data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
7.2 Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
7.3 Flash Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
8 Validation 33
8.1 Set up validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
8.2 Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
8.3 Validation Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
8.4 Custom Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
8.5 Custom Validation Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
8.6 Validation Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
9 Migrations 41
9.1 Database Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
9.2 Migrations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
10 Fluent Query Builder 47
10.1 Retrieving Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
10.2 Where Clauses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
10.3 Table Joins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
10.4 Ordering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
10.5 Limiting.. no Taking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
10.6 Skipping Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
10.7 Aggregates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
10.8 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
剩余137页未读,继续阅读
资源评论
- mrmain2015-04-13这个框架用的人太少了,不过是个好框架,开发可以用来做参考
dd425191101
- 粉丝: 0
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功