Showing 10 of 1,280 results.

Laravel 5 Collections: Retrieving Collection Elements With all

The all method can be used to retrieve the underlying array that the collection is using to hold its data.The signature of the all method is: 1 public function all ( ) ;The following code demonstrates the usage of the all method: 1 use Illuminate...

Laravel Collection Public API: pull

pull($key, $default = null) The pull method will remove an item from the collection while returning its value. If the item is not in the collection, the optional $default value will be returned. The pull method will modify the original collection....

Laravel Array Helper Function: array_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...

Laravel Collection Public API: pop

pop The pop method is used to retrieve the last item from the collection while also removing it from the collection. If there are no items in the collection, the pop method will return null . The following sample demonstrates the use of the pop...

Laravel String Helper Function: contains

The contains helper method will check if any of the $needles are in the given $haystack . If any of the given $needles are found in the $haystack , the method will return true , otherwise it returns false . $needles can be any value that can be...

Laravel Application Helper: policy

policy($class) The policy helper function can be used to retrieve a policy (a policy class can be any valid PHP class) instance for a given $class . The $class can be either a string or an object instance. If no policies for the given $class have...

Laravel 5: Accessing Session Input Data With old

The old helper function is used to retrieve an old input item. It is a shortcut to calling the Illuminate\Http\Request::old instance method. It accepts a $key argument and a $default argument. They $key should be the name of the input item to...