Collection
Extends
Implements
Methods
find ( $key , $default ) : Model |static|null
Find a model in the collection by key.
Parameters
- $key mixed
- $default mixed
load ( $relations ) : $this
Load a set of relationships onto the collection.
Parameters
- $relations array|string
loadAggregate ( $relations , $column , $function ) : $this
Load a set of aggregations over relationship's column onto the collection.
Parameters
- $relations array|string
- $column string
- $function string
loadCount ( $relations ) : $this
Load a set of relationship counts onto the collection.
Parameters
- $relations array|string
loadMax ( $relations , $column ) : $this
Load a set of relationship's max column values onto the collection.
Parameters
- $relations array|string
- $column string
loadMin ( $relations , $column ) : $this
Load a set of relationship's min column values onto the collection.
Parameters
- $relations array|string
- $column string
loadSum ( $relations , $column ) : $this
Load a set of relationship's column summations onto the collection.
Parameters
- $relations array|string
- $column string
loadAvg ( $relations , $column ) : $this
Load a set of relationship's average column values onto the collection.
Parameters
- $relations array|string
- $column string
loadExists ( $relations ) : $this
Load a set of related existences onto the collection.
Parameters
- $relations array|string
loadMissing ( $relations ) : $this
Load a set of relationships onto the collection if they are not already eager loaded.
Parameters
- $relations array|string
loadMissingRelation ( $models , array $path ) : void
Load a relationship path if it is not already eager loaded.
Parameters
- $models Collection
- $path array
loadMorph ( $relation , $relations ) : $this
Load a set of relationships onto the mixed relationship collection.
Parameters
- $relation string
- $relations array
loadMorphCount ( $relation , $relations ) : $this
Load a set of relationship counts onto the mixed relationship collection.
Parameters
- $relation string
- $relations array
contains ( $key , $operator , $value ) : bool
Determine if a key exists in the collection.
Parameters
- $key mixed
- $operator mixed
- $value mixed
modelKeys ( ) : array
Get the array of primary keys.
merge ( $items ) : static
Merge the collection with the given items.
Parameters
- $items ArrayAccess |array
map ( callable $callback ) : Collection |static
Run a map over each of the items.
Parameters
- $callback callable
mapWithKeys ( callable $callback ) : Collection |static
Run an associative map over each of the items.
Parameters
- $callback callable
fresh ( $with ) : static
Reload a fresh model instance from the database for all the entities.
Parameters
- $with array|string
diff ( $items ) : static
Diff the collection with the given items.
Parameters
- $items ArrayAccess |array
intersect ( $items ) : static
Intersect the collection with the given items.
Parameters
- $items ArrayAccess |array
unique ( $key , $strict ) : static
Return only unique items from the collection.
Parameters
- $key string|callable|null
- $strict bool
only ( $keys ) : static
Returns only the models from the collection with the specified keys.
Parameters
- $keys mixed
except ( $keys ) : static
Returns all models in the collection except the models with specified keys.
Parameters
- $keys mixed
makeHidden ( $attributes ) : $this
Make the given, typically visible, attributes hidden across the entire collection.
Parameters
- $attributes array|string
makeVisible ( $attributes ) : $this
Make the given, typically hidden, attributes visible across the entire collection.
Parameters
- $attributes array|string
append ( $attributes ) : $this
Append an attribute across the entire collection.
Parameters
- $attributes array|string
getDictionary ( $items ) : array
Get a dictionary keyed by primary keys.
Parameters
- $items ArrayAccess |array|null
pluck ( $value , $key ) : Collection
Get an array with the values of a given key.
Parameters
- $value string|array
- $key string|null
zip ( $items ) : Collection
Zip the collection together with one or more arrays.
Parameters
- $items mixed
flatten ( $depth ) : Collection
Get a flattened array of the items in the collection.
Parameters
- $depth int
pad ( $size , $value ) : Collection
Pad collection to the specified length with a value.
Parameters
- $size int
- $value mixed
duplicateComparator ( $strict ) : Closure
Get the comparison function to detect duplicates.
Parameters
- $strict bool
getQueueableClass ( ) : string|null
Get the type of the entities being queued.
getQueueableIds ( ) : array
Get the identifiers for all of the entities.
getQueueableRelations ( ) : array
Get the relationships of the entities being queued.
getQueueableConnection ( ) : string|null
Get the connection of the entities being queued.