Search

Showing 7 of 1,216 result(s)

/blog/2018/04/11/laravel-5-collapsing-a-multi-dimensional-array-to-a-single-level-with-collapse

The collapse helper method accepts an array as its only parameter. The given $array can be a single array, or a nested array. The method will then return a new array with the contents of all the nested arrays. Arrays that are collapsed can contain...

/blog/2018/04/11/laravel-5-conditionally-retrieving-array-values-with-where

The where helper method is functionally similar to the pluck method, in that both take a source $array and filter it to produce a smaller array. It works by iterating over each element in the $array and executing the $callback on each key value...

/blog/2018/04/11/laravel-5-determining-if-an-array-contains-an-element-with-exists

The exists helper method is similar to PHP's array_key_exists function in that in can be used to check if the given $key or index exists with the provided $array . The exists method defines two parameters, and both are required. Any value that...

/blog/2018/04/11/laravel-5-determining-if-an-object-is-array-accessible-with-accessible

The accessible helper method is used to determine whether the given $value is array accessible. A value $value is array accessible if the value is an array or an instance of ArrayAccess .The signature of the accessible method is:The following...

/blog/2018/04/11/laravel-5-ensuring-a-value-is-an-array-with-wrap

At some point in your PHP adventures, you have either seen, or written code like the following: The wrap method allows you to accomplish the same task with much cleaner, and clearer syntax.

/blog/2018/04/11/laravel-5-excluding-items-from-an-array-with-except

The except helper method will return all the key/value pairs of the $array where the keys in the original array are not in the $keys array.

/blog/2018/04/11/laravel-5-filtering-array-elements-with-only

The only method can be used to retrieve a subset of the provided array. The subset of the returned array is based on the values supplied to the $key parameter.