Search

Showing 7 of 1,216 result(s)

/blog/2016/11/20/laravel-application-helper-function-redirect#content-accessing-the-redirector-using-redirect

The Redirector class has many useful methods to help control the flow of users in your application. This section will not cover each method in detail, but simply shows how they can be used in conjunction with the redirect helper function:

/blog/2016/11/20/laravel-application-helper-function-redirect#content-redirecting-to-custom-urls

The Redirector does not provide a direct way to add additional information when generated the final URL, except for the $secure parameter. Luckily, the Redirect uses the Illuminate\Routing\UrlGenerator when generating URLs. Specifically, it calls...

/blog/2016/11/20/laravel-application-helper-function-redirect#content-changing-the-http-status-code

To change the status code of the response simply supply an argument for the $status parameter:

/blog/2016/11/20/laravel-application-helper-function-redirect#content-supplying-additional-headers

In order to supply extra headers we must also provide an argument for $status and then supply an argument for $headers :

/blog/2016/11/20/laravel-array-helper-function-array_where#content-comparing-just-the-value

Assume we have an array of numbers, from 0 to 100 : An array of all numbers less than or equal to 10 can be created like so: $smallNumbers would then look like this:

/blog/2016/11/20/laravel-array-helper-function-array_where#content-comparing-both-key-and-value

That example only used the $value from the array, the following example will make use of both the key and value. Consider the following array of students and test scores: Let's assume that any test score below a 70 is a failing grade. What we want...

/blog/2016/11/20/laravel-array-helper-function-array_where#content-comparing-just-the-key

For completeness, let's look at an example of just utilizing the key from the key/value compare with the where method. Let's add another array to the mix to keep track of all the students that are currently suspended: Now we want to get only the...