Skip to content

Commit 45fac72

Browse files
author
saiwang
committed
sync with official docs and add more chinese translation
1 parent fa2448f commit 45fac72

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2938
-1070
lines changed

cache.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ Cache sections allow you to group related items in the cache, and then flush the
9191

9292
**Accessing A Cache Section**
9393

94-
Cache::section('people')->put('John', $john);
94+
Cache::section('people')->put('John', $john, $minutes);
9595

96-
Cache::section('people')->put('Anne', $anne);
96+
Cache::section('people')->put('Anne', $anne, $minutes);
9797

9898
You may also access cached items from the section, as well as use the other cache methods such as `increment` and `decrement`:
9999

cn/cache.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ Laravel 对不同的缓存机制提供了一套统一的API。缓存配置信息
9191

9292
**访问缓存区**
9393

94-
Cache::section('people')->put('John', $john);
94+
Cache::section('people')->put('John', $john, $minutes);
9595

96-
Cache::section('people')->put('Anne', $anne);
96+
Cache::section('people')->put('Anne', $anne, $minutes);
9797

9898
你也可以从缓存区中取得缓存项,也可以使用其他的缓存方法,例如`increment``decrement`
9999

cn/commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
默认情况下,生成的类文件被存放在 `app/commands` 目录下,同时你也可以指定自定义目录和命名空间:
2525

26-
php artisan command:make FooCommand --path="app/classes" --namespace="Classes"
26+
php artisan command:make FooCommand --path=app/classes --namespace=Classes
2727

2828
### 实现命令
2929

cn/configuration.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
Config::set('database.default', 'sqlite');
2727

28+
在程序运行时设置的配置值只在本次请求中有效,不会对以后的请求造成影响。
29+
2830
<a name="environment-configuration"></a>
2931
## 环境配置
3032

@@ -54,6 +56,8 @@
5456

5557
));
5658

59+
在此案例中,'local' 是运行环境的名称,'your-machine-name' 是服务器的主机名。在Linux和Mac上,可以通过 `hostname` 命令来确定所用机器的主机名。
60+
5761
你还可以在调用`detectEnvironment`时传递一个`闭包(Closure)` , 这样你就可以自己检查环境:
5862

5963
$env = $app->detectEnvironment(function()

cn/contributing.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77
<a name="introduction"></a>
88
## 简介
99

10-
Laravel是免费、开源的软件,这意味着任何人都可以为其开发和进步贡献力量。Laravel源代码目前托管在[Github](http://github.com)上,Github提供非常容易的途径fork项目和合并你的贡献。
10+
Laravel是免费、开源的软件,这意味着任何人都可以为其开发和进步贡献力量。Laravel源代码目前托管在[Github](https://github.com/laravel)上,Github提供非常容易的途径fork项目和合并你的贡献。
1111

1212
<a name="pull-requests"></a>
1313
## Pull Requests
1414

1515
pull request 的处理过程对于新特性和bug是不一样的。在你发起一个新特性的pull request之前,你应该先创建一个带有`[Proposal]`标题的issue。这个proposal应当描述这个新特性,以及实现方法。提议将会被审查,有可能会被采纳,也有可能会被拒绝。当一个提议被采纳,将会创建一个实现新特性的pull request。没有遵循上述指南的pull request将会被立即关闭。
1616

17-
为bug创建的Pull requests不需要创建建议issue。如果你有解决bug的办法,请详细描述你的解决方案。。
17+
为bug创建的Pull requests不需要创建建议issue。如果你有解决bug的办法,请详细描述你的解决方案。
18+
19+
对文档的增加和修改也可以提交到Github上的[文档源码库](https://github.com/laravel/docs)
1820

1921
### 提交新特性
2022

cn/controllers.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,12 @@
8686
*/
8787
public function __construct()
8888
{
89-
$this->beforeFilter(function()
90-
{
91-
//
92-
});
89+
$this->beforeFilter('auth', array('except' => 'getLogin'));
90+
91+
$this->beforeFilter('csrf', array('on' => 'post'));
92+
93+
$this->afterFilter('log', array('only' =>
94+
array('fooAction', 'barAction')));
9395
}
9496

9597
}
@@ -142,15 +144,15 @@ Laravel框架中,你可以使用简单的REST命名规范,轻松定义单个
142144

143145
**资源控制器中不同操作的用途**
144146

145-
Verb | Path | Action | Route Name
146-
----------|-----------------------|--------------|---------------------
147-
GET | /resource | index | resource.index
148-
GET | /resource/create | create | resource.create
149-
POST | /resource | store | resource.store
150-
GET | /resource/{id} | show | resource.show
151-
GET | /resource/{id}/edit | edit | resource.edit
152-
PUT/PATCH | /resource/{id} | update | resource.update
153-
DELETE | /resource/{id} | destroy | resource.destroy
147+
Verb | Path | Action | Route Name
148+
----------|-----------------------------|--------------|---------------------
149+
GET | /resource | index | resource.index
150+
GET | /resource/create | create | resource.create
151+
POST | /resource | store | resource.store
152+
GET | /resource/{resource} | show | resource.show
153+
GET | /resource/{resource}/edit | edit | resource.edit
154+
PUT/PATCH | /resource/{resource} | update | resource.update
155+
DELETE | /resource/{resource} | destroy | resource.destroy
154156

155157
有时你也许只需要处理其中一部分资源操作:
156158

@@ -163,6 +165,9 @@ DELETE | /resource/{id} | destroy | resource.destroy
163165
Route::resource('photo', 'PhotoController',
164166
array('only' => array('index', 'show')));
165167

168+
Route::resource('photo', 'PhotoController',
169+
array('except' => array('create', 'store', 'update', 'delete')));
170+
166171
<a name="handling-missing-methods"></a>
167172
## 处理空方法 (Handling Missing Methods)
168173

cn/database.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,7 @@ Laravel 目前支持四种数据库系统,分别是: MySQL, Postgres, SQLite
8383
Laravel默认会为当前请求执行的的所有查询生成日志并保存在内存中。 因此, 在某些特殊的情况下, 比如一次性向数据库中插入大量数据, 就可能导致内存不足。 在这种情况下,你可以通过 `disableQueryLog` 方法来关闭查询日志:
8484

8585
DB::connection()->disableQueryLog();
86+
87+
调用 `getQueryLog` 方法可以同时获取多个查询执行后的日志:
88+
89+
$queries = DB::getQueryLog();

cn/documentation.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
- [配置](/docs/configuration)
88
- [Request的生命周期](/docs/lifecycle)
99
- [路由](/docs/routing)
10-
- [Requests & Input](/docs/requests)
10+
- [请求与输入](/docs/requests)
1111
- [视图 & Response](/docs/responses)
1212
- [控制器](/docs/controllers)
1313
- [错误 & 日志](/docs/errors)
1414
- 深度历险
1515
- [缓存](/docs/cache)
16+
- [核心扩展](/docs/extending)
1617
- [事件](/docs/events)
1718
- [Facades](/docs/facades)
1819
- [表单 & HTML](/docs/html)
@@ -32,11 +33,11 @@
3233
- [基本用法](/docs/database)
3334
- [查询构造器](/docs/queries)
3435
- [Eloquent ORM](/docs/eloquent)
35-
- [Schema Builder](/docs/schema)
36-
- [Migrations & Seeding](/docs/migrations)
36+
- [结构生成器](/docs/schema)
37+
- [迁移 & 数据填充](/docs/migrations)
3738
- [Redis](/docs/redis)
3839
- Artisan 命令行工具
3940
- [概览](/docs/artisan)
40-
- [开发工具](/docs/commands)
41+
- [Artisan 开发](/docs/commands)
4142
- 贡献者
4243
- [中文翻译贡献者名单](/docs/contributors)

0 commit comments

Comments
 (0)