Search

Showing 7 of 1,216 result(s)

/blog/2018/04/11/laravel-5-filtering-array-elements-with-only#content-global-arrayonly-helper-function

The array_only function is a shortcut to calling Arr::only . This function is declared in the global namespace.

/blog/2018/04/11/laravel-5-finding-the-first-occurrence-of-an-element-matching-a-condition-with-first#content-example-use

The following code sample is an anonymous function assigned to a variable named $isPostFormat . The following example will use the Str::is helper method to check if a value is of the format /post/* : If a given value satisfies the format, true is...

/blog/2018/04/11/laravel-5-finding-the-first-occurrence-of-an-element-matching-a-condition-with-first#content-optional-callback-parameter

The $callback function is an optional parameter, and can be omitted. When the $callback parameter is omitted, the first method will return the first item in the array:

/blog/2018/04/11/laravel-5-finding-the-last-occurrence-of-an-element-matching-a-condition-with-last#content-example-use

The following section builds of the code example we covered in the first section; using it, we can find the last post in a list that matches the /post/* format: we could get the last post in the following array like so: the value of $lastPost...