Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
summerblue committed Sep 3, 2016
1 parent 9a5196a commit 0c48986
Show file tree
Hide file tree
Showing 63 changed files with 181 additions and 125 deletions.
Empty file modified apis.md 100644 → 100755
Empty file.
Empty file modified application-testing.md 100644 → 100755
Empty file.
Empty file modified artisan.md 100644 → 100755
Empty file.
4 changes: 4 additions & 0 deletions authentication.md 100644 → 100755
Expand Up @@ -487,6 +487,10 @@ Laravel raises a variety of [events](/docs/{{version}}/events) during the authen
'Illuminate\Auth\Events\Attempting' => [
'App\Listeners\LogAuthenticationAttempt',
],
'Illuminate\Auth\Events\Authenticated' => [
'App\Listeners\LogAuthenticated',
],

'Illuminate\Auth\Events\Login' => [
'App\Listeners\LogSuccessfulLogin',
Expand Down
1 change: 1 addition & 0 deletions authorization.md 100644 → 100755
Expand Up @@ -29,6 +29,7 @@ It is important to not view gates and policies as mutually exclusive for your ap
<a name="gates"></a>
## Gates

<a name="writing-gates"></a>
### Writing Gates

Gates are Closures that determine if a user is authorized to perform a given action and are typically defined in the `App\Providers\AuthServiceProvider` class using the `Gate` facade. Gates always receive a user instance as their first argument, and may optionally receive additional arguments such as a relevant Eloquent model:
Expand Down
2 changes: 1 addition & 1 deletion billing.md 100644 → 100755
Expand Up @@ -112,7 +112,7 @@ For many operations, the Stripe and Braintree implementations of Cashier functio

First, add the Cashier package for Braintree to your `composer.json` file and run the `composer update` command:

"laravel/cashier-braintree": "~1.0"
"laravel/cashier-braintree": "~2.0"

#### Service Provider

Expand Down
Empty file modified blade.md 100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion broadcasting.md 100644 → 100755
Expand Up @@ -185,7 +185,7 @@ The `ShouldBroadcast` interface requires you to implement a single method: `broa
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class ServerCreated extends Event implements ShouldBroadcast
class ServerCreated implements ShouldBroadcast
{
use SerializesModels;

Expand Down
Empty file modified cache.md 100644 → 100755
Empty file.
54 changes: 50 additions & 4 deletions collections.md 100644 → 100755
Expand Up @@ -75,10 +75,12 @@ For the remainder of this documentation, we'll discuss each method available on
[keys](#method-keys)
[last](#method-last)
[map](#method-map)
[mapWithKeys](#method-mapwithkeys)
[max](#method-max)
[merge](#method-merge)
[min](#method-min)
[only](#method-only)
[pipe](#method-pipe)
[pluck](#method-pluck)
[pop](#method-pop)
[prepend](#method-prepend)
Expand Down Expand Up @@ -682,10 +684,41 @@ The `map` method iterates through the collection and passes each value to the gi

> {note} Like most other collection methods, `map` returns a new collection instance; it does not modify the collection it is called on. If you want to transform the original collection, use the [`transform`](#method-transform) method.
<a name="method-mapwithkeys"></a>
#### `mapWithKeys()` {#collection-method}

The `mapWithKeys` method iterates through the collection and passes each value to the given callback. The callback should return an associative array containing a single key / value pair:

$collection = collect([
[
'name' => 'John',
'department' => 'Sales',
'email' => 'john@example.com'
],
[
'name' => 'Jane',
'department' => 'Marketing',
'email' => 'jane@example.com'
]
]);

$keyed = $collection->mapWithKeys(function ($item) {
return [$item['email'] => $item['name']];
});

$keyed->all();

/*
[
'john@example.com' => 'John',
'jane@example.com' => 'Jane',
]
*/

<a name="method-max"></a>
#### `max()` {#collection-method}

The `max` method return the maximum value of a given key:
The `max` method returns the maximum value of a given key:

$max = collect([['foo' => 10], ['foo' => 20]])->max('foo');

Expand All @@ -706,7 +739,7 @@ The `merge` method merges the given array into the original collection. If a str

$merged->all();

// ['product_id' => 1, price' => 200, 'discount' => false]
// ['product_id' => 1, 'price' => 200, 'discount' => false]

If the given array's keys are numeric, the values will be appended to the end of the collection:

Expand All @@ -721,7 +754,7 @@ If the given array's keys are numeric, the values will be appended to the end of
<a name="method-min"></a>
#### `min()` {#collection-method}

The `min` method return the minimum value of a given key:
The `min` method returns the minimum value of a given key:

$min = collect([['foo' => 10], ['foo' => 20]])->min('foo');

Expand All @@ -746,6 +779,19 @@ The `only` method returns the items in the collection with the specified keys:

For the inverse of `only`, see the [except](#method-except) method.

<a name="method-pipe"></a>
#### `pipe()` {#collection-method}

The `pipe` method passes the collection to the given callback and returns the result:

$collection = collect([1, 2, 3]);

$piped = $collection->pipe(function ($collection) {
return $collection->sum();
});

// 6

<a name="method-pluck"></a>
#### `pluck()` {#collection-method}

Expand Down Expand Up @@ -1190,7 +1236,7 @@ The `toJson` method converts the collection into JSON:

$collection->toJson();

// '{"name":"Desk","price":200}'
// '{"name":"Desk", "price":200}'

<a name="method-transform"></a>
#### `transform()` {#collection-method}
Expand Down
Empty file modified container.md 100644 → 100755
Empty file.
Empty file modified contracts.md 100644 → 100755
Empty file.
Empty file modified contributing.md 100644 → 100755
Empty file.
Empty file modified controllers.md 100644 → 100755
Empty file.
Empty file modified csrf.md 100644 → 100755
Empty file.
Empty file modified database-testing.md 100644 → 100755
Empty file.
1 change: 0 additions & 1 deletion database.md 100644 → 100755
Expand Up @@ -7,7 +7,6 @@
- [Running Raw SQL Queries](#running-queries)
- [Listening For Query Events](#listening-for-query-events)
- [Database Transactions](#database-transactions)
- [Using Multiple Database Connections](#accessing-connections)

<a name="introduction"></a>
## Introduction
Expand Down
147 changes: 73 additions & 74 deletions documentation.md 100644 → 100755
@@ -1,81 +1,80 @@
- 前言
- [翻译说明](/docs/{{version}}/about)
- [发行说明](/docs/{{version}}/releases)
- [升级说明](/docs/{{version}}/upgrade)
- [贡献导引](/docs/{{version}}/contributions)
- [API 文档](/api/{{version}})
- 入门指南
- [安装](/docs/{{version}}/installation)
- [配置信息](/docs/{{version}}/configuration)
- [文件夹结构](/docs/{{version}}/structure)
- [错误与日志](/docs/{{version}}/errors)
- 开发环境部署
- Prologue
- [Release Notes](/docs/{{version}}/releases)
- [Upgrade Guide](/docs/{{version}}/upgrade)
- [Contribution Guide](/docs/{{version}}/contributions)
- [API Documentation](/api/{{version}})
- Getting Started
- [Installation](/docs/{{version}}/installation)
- [Configuration](/docs/{{version}}/configuration)
- [Directory Structure](/docs/{{version}}/structure)
- [Errors & Logging](/docs/{{version}}/errors)
- Dev Environments
- [Homestead](/docs/{{version}}/homestead)
- [Valet](/docs/{{version}}/valet)
- 核心概念
- [服务容器](/docs/{{version}}/container)
- [服务提供者](/docs/{{version}}/providers)
- Core Concepts
- [Service Container](/docs/{{version}}/container)
- [Service Providers](/docs/{{version}}/providers)
- [Facades](/docs/{{version}}/facades)
- [Contracts](/docs/{{version}}/contracts)
- HTTP
- [路由](/docs/{{version}}/routing)
- [中间件](/docs/{{version}}/middleware)
- [CSRF 保护](/docs/{{version}}/csrf)
- [控制器](/docs/{{version}}/controllers)
- [请求](/docs/{{version}}/requests)
- [响应](/docs/{{version}}/responses)
- The HTTP Layer
- [Routing](/docs/{{version}}/routing)
- [Middleware](/docs/{{version}}/middleware)
- [CSRF Protection](/docs/{{version}}/csrf)
- [Controllers](/docs/{{version}}/controllers)
- [Requests](/docs/{{version}}/requests)
- [Responses](/docs/{{version}}/responses)
- [Session](/docs/{{version}}/session)
- [表单验证](/docs/{{version}}/validation)
- 视图和模板
- [视图](/docs/{{version}}/views)
- [Blade 模板](/docs/{{version}}/blade)
- [本地化](/docs/{{version}}/localization)
- JavaScript CSS
- [入门指南](/docs/{{version}}/frontend)
- [Elixir](/docs/{{version}}/elixir)
- 安全
- [用户认证](/docs/{{version}}/authentication)
- [用户授权](/docs/{{version}}/authorization)
- [重置密码](/docs/{{version}}/passwords)
- [API 认证](/docs/{{version}}/passport)
- [加密解密](/docs/{{version}}/encryption)
- [哈希](/docs/{{version}}/hashing)
- 综合话题
- [广播系统](/docs/{{version}}/broadcasting)
- [缓存系统](/docs/{{version}}/cache)
- [事件系统](/docs/{{version}}/events)
- [文件存储](/docs/{{version}}/filesystem)
- [邮件发送](/docs/{{version}}/mail)
- [消息通知](/docs/{{version}}/notifications)
- [队列](/docs/{{version}}/queues)
- 数据库
- [快速入门](/docs/{{version}}/database)
- [查询构造器](/docs/{{version}}/queries)
- [分页](/docs/{{version}}/pagination)
- [数据库迁移](/docs/{{version}}/migrations)
- [数据填充](/docs/{{version}}/seeding)
- [Validation](/docs/{{version}}/validation)
- Views & Templates
- [Views](/docs/{{version}}/views)
- [Blade Templates](/docs/{{version}}/blade)
- [Localization](/docs/{{version}}/localization)
- JavaScript & CSS
- [Getting Started](/docs/{{version}}/frontend)
- [Compiling Assets](/docs/{{version}}/elixir)
- Security
- [Authentication](/docs/{{version}}/authentication)
- [Authorization](/docs/{{version}}/authorization)
- [Password Reset](/docs/{{version}}/passwords)
- [API Authentication](/docs/{{version}}/passport)
- [Encryption](/docs/{{version}}/encryption)
- [Hashing](/docs/{{version}}/hashing)
- General Topics
- [Broadcasting](/docs/{{version}}/broadcasting)
- [Cache](/docs/{{version}}/cache)
- [Events](/docs/{{version}}/events)
- [File Storage](/docs/{{version}}/filesystem)
- [Mail](/docs/{{version}}/mail)
- [Notifications](/docs/{{version}}/notifications)
- [Queues](/docs/{{version}}/queues)
- Database
- [Getting Started](/docs/{{version}}/database)
- [Query Builder](/docs/{{version}}/queries)
- [Pagination](/docs/{{version}}/pagination)
- [Migrations](/docs/{{version}}/migrations)
- [Seeding](/docs/{{version}}/seeding)
- [Redis](/docs/{{version}}/redis)
- Eloquent ORM
- [快速入门](/docs/{{version}}/eloquent)
- [模型关联](/docs/{{version}}/eloquent-relationships)
- [Eloquent 集合](/docs/{{version}}/eloquent-collections)
- [Getter/Setter](/docs/{{version}}/eloquent-mutators)
- [序列化](/docs/{{version}}/eloquent-serialization)
- Artisan 控制台
- [Artisan 命令行](/docs/{{version}}/artisan)
- [任务调度](/docs/{{version}}/scheduling)
- 测试
- [快速入门](/docs/{{version}}/testing)
- [应用程序测试](/docs/{{version}}/application-testing)
- [数据库](/docs/{{version}}/database-testing)
- [Mocking 取模](/docs/{{version}}/mocking)
- 官方扩展包
- [Cashier 交易工具包](/docs/{{version}}/billing)
- [Envoy 部署工具](/docs/{{version}}/envoy)
- [Passport OAuth 认证](/docs/{{version}}/passport)
- [Scout 全文搜索](/docs/{{version}}/scout)
- [Socialite 社会化登录](https://github.com/laravel/socialite)
- 附录
- [集合](/docs/{{version}}/collections)
- [辅助函数](/docs/{{version}}/helpers)
- [扩展包开发](/docs/{{version}}/packages)
- [Getting Started](/docs/{{version}}/eloquent)
- [Relationships](/docs/{{version}}/eloquent-relationships)
- [Collections](/docs/{{version}}/eloquent-collections)
- [Mutators](/docs/{{version}}/eloquent-mutators)
- [Serialization](/docs/{{version}}/eloquent-serialization)
- Artisan Console
- [Commands](/docs/{{version}}/artisan)
- [Task Scheduling](/docs/{{version}}/scheduling)
- Testing
- [Getting Started](/docs/{{version}}/testing)
- [Application Testing](/docs/{{version}}/application-testing)
- [Database](/docs/{{version}}/database-testing)
- [Mocking](/docs/{{version}}/mocking)
- Official Packages
- [Cashier](/docs/{{version}}/billing)
- [Envoy](/docs/{{version}}/envoy)
- [Passport](/docs/{{version}}/passport)
- [Scout](/docs/{{version}}/scout)
- [Socialite](https://github.com/laravel/socialite)
- Appendix
- [Collections](/docs/{{version}}/collections)
- [Helpers](/docs/{{version}}/helpers)
- [Packages](/docs/{{version}}/packages)
Empty file modified elixir.md 100644 → 100755
Empty file.
Empty file modified eloquent-collections.md 100644 → 100755
Empty file.
Empty file modified eloquent-mutators.md 100644 → 100755
Empty file.
Empty file modified eloquent-relationships.md 100644 → 100755
Empty file.
Empty file modified eloquent-serialization.md 100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion eloquent.md 100644 → 100755
Expand Up @@ -304,7 +304,7 @@ Updates can also be performed against any number of models that match a given qu

The `update` method expects an array of column and value pairs representing the columns that should be updated.

> {note} When issuing a mass update via Eloquent, the `saved` and `updated` model events will be not be fired for the updated models. This is because the models are never actually retrieved when issuing a mass update.
> {note} When issuing a mass update via Eloquent, the `saved` and `updated` model events will not be fired for the updated models. This is because the models are never actually retrieved when issuing a mass update.
<a name="mass-assignment"></a>
### Mass Assignment
Expand Down
Empty file modified encryption.md 100644 → 100755
Empty file.
Empty file modified envoy.md 100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions errors.md 100644 → 100755
Expand Up @@ -71,7 +71,7 @@ If you would like to have complete control over how Monolog is configured for yo
<a name="report-method"></a>
### The Report Method

All exceptions are handled by the `App\Exceptions\Handler` class. This class contains two methods: `report` and `render`. We'll examine each of these methods in detail. The `report` method is used to log exceptions or send them to an external service like [BugSnag](https://bugsnag.com) or [Sentry](https://github.com/getsentry/sentry-laravel). By default, the `report` method simply passes the exception to the base class where the exception is logged. However, you are free to log exceptions however you wish.
All exceptions are handled by the `App\Exceptions\Handler` class. This class contains two methods: `report` and `render`. We'll examine each of these methods in detail. The `report` method is used to log exceptions or send them to an external service like [Bugsnag](https://bugsnag.com) or [Sentry](https://github.com/getsentry/sentry-laravel). By default, the `report` method simply passes the exception to the base class where the exception is logged. However, you are free to log exceptions however you wish.

For example, if you need to report different types of exceptions in different ways, you may use the PHP `instanceof` comparison operator:

Expand All @@ -85,7 +85,7 @@ For example, if you need to report different types of exceptions in different wa
*/
public function report(Exception $exception)
{
if ($e instanceof CustomException) {
if ($exception instanceof CustomException) {
//
}

Expand Down
Empty file modified events.md 100644 → 100755
Empty file.
Empty file modified facades.md 100644 → 100755
Empty file.
Empty file modified filesystem.md 100644 → 100755
Empty file.
Empty file modified frontend.md 100644 → 100755
Empty file.
Empty file modified hashing.md 100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions helpers.md 100644 → 100755
Expand Up @@ -39,6 +39,7 @@ Laravel includes a variety of global "helper" PHP functions. Many of these funct
[array_last](#method-array-last)
[array_only](#method-array-only)
[array_pluck](#method-array-pluck)
[array_prepend](#method-array-prepend)
[array_pull](#method-array-pull)
[array_set](#method-array-set)
[array_sort](#method-array-sort)
Expand Down
10 changes: 1 addition & 9 deletions homestead.md 100644 → 100755
Expand Up @@ -21,7 +21,7 @@

Laravel strives to make the entire PHP development experience delightful, including your local development environment. [Vagrant](http://vagrantup.com) provides a simple, elegant way to manage and provision Virtual Machines.

Laravel Homestead is an official, pre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, HHVM, a web server, and any other server software on your local machine. No more worrying about messing up your operating system! Vagrant boxes are completely disposable. If something goes wrong, you can destroy and re-create the box in minutes!
Laravel Homestead is an official, pre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, a web server, and any other server software on your local machine. No more worrying about messing up your operating system! Vagrant boxes are completely disposable. If something goes wrong, you can destroy and re-create the box in minutes!

Homestead runs on any Windows, Mac, or Linux system, and includes the Nginx web server, PHP 7.0, MySQL, Postgres, Redis, Memcached, Node, and all of the other goodies you need to develop amazing Laravel applications.

Expand All @@ -33,7 +33,6 @@ Homestead runs on any Windows, Mac, or Linux system, and includes the Nginx web
- Ubuntu 16.04
- Git
- PHP 7.0
- HHVM
- Nginx
- MySQL
- MariaDB
Expand Down Expand Up @@ -107,13 +106,6 @@ Not familiar with Nginx? No problem. The `sites` property allows you to easily m
- map: homestead.app
to: /home/vagrant/Code/Laravel/public

You can make any Homestead site use [HHVM](http://hhvm.com) by setting the `hhvm` option to `true`:

sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
hhvm: true

If you change the `sites` property after provisioning the Homestead box, you should re-run `vagrant reload --provision` to update the Nginx configuration on the virtual machine.

#### The Hosts File
Expand Down
Empty file modified license.md 100644 → 100755
Empty file.
Empty file modified lifecycle.md 100644 → 100755
Empty file.
Empty file modified localization.md 100644 → 100755
Empty file.
Empty file modified mail.md 100644 → 100755
Empty file.
Empty file modified middleware.md 100644 → 100755
Empty file.
8 changes: 5 additions & 3 deletions migrations.md 100644 → 100755
Expand Up @@ -253,12 +253,14 @@ Below is a list of all the available column modifiers. This list does not includ

Modifier | Description
------------- | -------------
`->first()` | Place the column "first" in the table (MySQL Only)
`->after('column')` | Place the column "after" another column (MySQL Only)
`->nullable()` | Allow NULL values to be inserted into the column
`->comment('my comment')` | Add a comment to a column
`->default($value)` | Specify a "default" value for the column
`->first()` | Place the column "first" in the table (MySQL Only)
`->nullable()` | Allow NULL values to be inserted into the column
`->storedAs($expression)` | Create a stored generated column (MySQL Only)
`->unsigned()` | Set `integer` columns to `UNSIGNED`
`->comment('my comment')` | Add a comment to a column
`->virtualAs($expression)` | Create a virtual generated column (MySQL Only)

<a name="changing-columns"></a>
<a name="modifying-columns"></a>
Expand Down
2 changes: 1 addition & 1 deletion mocking.md 100644 → 100755
Expand Up @@ -10,7 +10,7 @@

When testing Laravel applications, you may wish to "mock" certain aspects of your application so they are not actually executed during a given test. For example, when testing a controller that fires an event, you may wish to mock the event listeners so they are not actually executed during the test. This allows you to only test the controller's HTTP response without worrying about the execution of the event listeners, since the event listeners can be tested in their own test case.

Laravel provides helpers for mocking events, jobs, and facades out of the box. These helpers primarily provide a convenience layer over Mockery so you do not have to manually make complicated Mockery method calls. Of course, are free to use [Mockery](http://docs.mockery.io/en/latest/) or PHPUnit to create your own mocks or spies.
Laravel provides helpers for mocking events, jobs, and facades out of the box. These helpers primarily provide a convenience layer over Mockery so you do not have to manually make complicated Mockery method calls. Of course, you are free to use [Mockery](http://docs.mockery.io/en/latest/) or PHPUnit to create your own mocks or spies.

<a name="mocking-events"></a>
## Events
Expand Down

0 comments on commit 0c48986

Please sign in to comment.