From 205a428371b6969754cf552410707fbd02d4ac38 Mon Sep 17 00:00:00 2001 From: Uziel Bueno Date: Fri, 26 Jun 2015 15:07:18 -0500 Subject: [PATCH] Added missing global helper functions --- helpers.md | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/helpers.md b/helpers.md index 3aa0e568520..3cc898f9e56 100644 --- a/helpers.md +++ b/helpers.md @@ -85,6 +85,16 @@ Laravel includes a variety of "helper" PHP functions. Many of these functions ar [url](#method-url) +### Routes + +
+[get](#method-route-get) +[post](#method-route-post) +[put](#method-route-put) +[patch](#method-route-patch) +[delete](#method-route-delete) +
+ ### Miscellaneous
@@ -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)
@@ -114,6 +130,9 @@ Laravel includes a variety of "helper" PHP functions. Many of these functions ar } + +## Arrays + #### `array_add()` {#collection-method .first-collection-method} @@ -595,6 +614,44 @@ The `url` function generates a fully qualified URL to the given path: echo url('user/profile', [1]); + +## Routes + + +#### `get()` {#collection-method} + +The `get` function creates a new **GET** route. You can use it as an alternative to the `Route` facade: + + get('/home'); + + +#### `post()` {#collection-method} + +The `post` function creates a new **POST** route. You can use it as an alternative to the `Route` facade: + + post('/users'); + + +#### `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}'); + + +#### `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}'); + + +#### `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}'); + ## Miscellaneous @@ -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(); + + +#### `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(); + + +#### `redirect()` {#collection-method} + +The `redirect` function return an instance of the redirector to do [redirects](/docs/{{version}}/responses#redirects): + + return redirect('/home'); + + +#### `back()` {#collection-method} + +The `back()` function redirects the user to the previous location, this is the simplest method: + + return back(); + + +#### `old()` {#collection-method} + +The `old` function [retrieves](/docs/{{version}}/requests#retrieving-input) an old input value flashed into the session.: + + $value = old('value'); + + +#### `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(); + + +#### `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'); \ No newline at end of file