Showing 10 of 1,278 results.

Laravel Collection Public API: contains

contains($key, $value = null) The contains method is used to determine if a given $key exists within the collection. Additionally, an option $value can be specified that will be used to check if a given key/value pair exists within the collection....

Laravel Artisan Generator Command: The make:policy Command

The make:policy command is used to generate to policy classes. It requires a name to be provided; this name will be used as the file name as well as the newly generated class name. Policy classes are stored within the app/Policies directory. The...

Laravel Collection Public API: reverse

reverse The reverse method is used to reverse the order of items in a collection. The reverse method returns a new Collection instance. The reverse method does not preserve numerical keys but will preserve non-numerical keys. The following code...

Laravel Miscellaneous Helper Function: data_set

data_set(&$target, $key, $value, $overwrite = true) The data_set helper function can be used to set the value of an item in an array or an object property using dot notation. It accepts a reference to a $target array or object; the $key (array key...

Laravel 5 Collections: Removing Collection Elements With forget

The forget method removes an item from the collection based on given $key . The forget method returns a reference to the original collection, meaning it modifies the collection instance it was called on.1 public function forget ( 2 $ keys 3 ) ;The...

Filter Search