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