Skip to content

Commit

Permalink
Merge branch '5.1' of https://github.com/uxweb/docs into uxweb-5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jun 29, 2015
2 parents 288fba6 + 205a428 commit 6fe0d85
Showing 1 changed file with 99 additions and 0 deletions.
99 changes: 99 additions & 0 deletions helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ Laravel includes a variety of "helper" PHP functions. Many of these functions ar
[url](#method-url)
</div>

### Routes

<div class="collection-method-list" markdown="1">
[get](#method-route-get)
[post](#method-route-post)
[put](#method-route-put)
[patch](#method-route-patch)
[delete](#method-route-delete)
</div>

### Miscellaneous

<div class="collection-method-list" markdown="1">
Expand All @@ -99,6 +109,12 @@ Laravel includes a variety of "helper" PHP functions. Many of these functions ar
[value](#method-value)
[view](#method-view)
[with](#method-with)
[auth](#method-auth)
[redirect](#method-redirect)
[back](#method-back)
[old](#method-old)
[factory](#method-factory)
[bcrypt](#method-bcrypt)
</div>

<a name="method-listing"></a>
Expand All @@ -114,6 +130,9 @@ Laravel includes a variety of "helper" PHP functions. Many of these functions ar
}
</style>

<a name="arrays"></a>
## Arrays

<a name="method-array-add"></a>
#### `array_add()` {#collection-method .first-collection-method}

Expand Down Expand Up @@ -595,6 +614,44 @@ The `url` function generates a fully qualified URL to the given path:

echo url('user/profile', [1]);

<a name="routes"></a>
## Routes

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

The `get` function creates a new **GET** route. You can use it as an alternative to the `Route` facade:

get('/home');

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

The `post` function creates a new **POST** route. You can use it as an alternative to the `Route` facade:

post('/users');

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

The `put` function creates a new **PUT** route. You can use it as an alternative to the `Route` facade:

put('/users/{id}');

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

The `patch` function creates a new **PATCH** route. You can use it as an alternative to the `Route` facade:

patch('/users/{id}');

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

The `delete` function creates a new **DELETE** route. You can use it as an alternative to the `Route` facade:

delete('/users/{id}');

<a name="miscellaneous"></a>
## Miscellaneous

Expand Down Expand Up @@ -681,3 +738,45 @@ The `view` function retrieves a [view](/docs/{{version}}/views) instance:
The `with` function return the value it is given. This function is primarily useful for method chaining where it would otherwise be impossible:

$value = with(new Foo)->work();

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

The `auth` function return the available auth instance. You can use it instead of the `Auth` facade for convenience:

$user = auth()->user();

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

The `redirect` function return an instance of the redirector to do [redirects](/docs/{{version}}/responses#redirects):

return redirect('/home');

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

The `back()` function redirects the user to the previous location, this is the simplest method:

return back();

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

The `old` function [retrieves](/docs/{{version}}/requests#retrieving-input) an old input value flashed into the session.:

$value = old('value');

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

The `factory` function creates a model factory builder for a given class, name, and amount. It can be used while [testing](/docs/{{version}}/testing#model-factories) or [seeding](/docs/{{version}}/seeding#using-model-factories):

$user = factory('App\User')->make();

<a href="method-bcrypt"></a>
#### `bcrypt()` {#collection-method}

The `bcrypt` function hash a given value. You can use it as an alternative to the `Hash` facade. See [hashing](/docs/{{version}}/hashing) for more:

$password = bcrypt('my-secret-password');

0 comments on commit 6fe0d85

Please sign in to comment.