DatabaseNotificationCollection
class DatabaseNotificationCollection extends Collection
Traits
Properties
| protected bool | $escapeWhenCastingToString | Indicates that the object's string representation should be escaped when __toString is invoked. |
from EnumeratesValues |
| static protected array<int, string> | $proxies | The methods that can be proxied. |
from EnumeratesValues |
| TValue> read-only | $average | from EnumeratesValues | |
| TValue> read-only | $avg | from EnumeratesValues | |
| TValue> read-only | $contains | from EnumeratesValues | |
| TValue> read-only | $doesntContain | from EnumeratesValues | |
| TValue> read-only | $each | from EnumeratesValues | |
| TValue> read-only | $every | from EnumeratesValues | |
| TValue> read-only | $filter | from EnumeratesValues | |
| TValue> read-only | $first | from EnumeratesValues | |
| TValue> read-only | $flatMap | from EnumeratesValues | |
| TValue> read-only | $groupBy | from EnumeratesValues | |
| TValue> read-only | $hasMany | from EnumeratesValues | |
| TValue> read-only | $hasSole | from EnumeratesValues | |
| TValue> read-only | $keyBy | from EnumeratesValues | |
| TValue> read-only | $last | from EnumeratesValues | |
| TValue> read-only | $map | from EnumeratesValues | |
| TValue> read-only | $max | from EnumeratesValues | |
| TValue> read-only | $min | from EnumeratesValues | |
| TValue> read-only | $partition | from EnumeratesValues | |
| TValue> read-only | $percentage | from EnumeratesValues | |
| TValue> read-only | $reject | from EnumeratesValues | |
| TValue> read-only | $skipUntil | from EnumeratesValues | |
| TValue> read-only | $skipWhile | from EnumeratesValues | |
| TValue> read-only | $some | from EnumeratesValues | |
| TValue> read-only | $sortBy | from EnumeratesValues | |
| TValue> read-only | $sortByDesc | from EnumeratesValues | |
| TValue> read-only | $sum | from EnumeratesValues | |
| TValue> read-only | $takeUntil | from EnumeratesValues | |
| TValue> read-only | $takeWhile | from EnumeratesValues | |
| TValue> read-only | $unique | from EnumeratesValues | |
| TValue> read-only | $unless | from EnumeratesValues | |
| TValue> read-only | $until | from EnumeratesValues | |
| TValue> read-only | $when | from EnumeratesValues | |
| static protected array | $macros | The registered string macros. |
from Macroable |
| protected TValue> | $items | The items contained in the collection. |
from Collection |
Methods
Apply the callback if the given "value" is (or resolves to) truthy.
Apply the callback if the given "value" is (or resolves to) falsy.
Create a new collection instance if the value isn't one already.
Wrap the given value in a collection if applicable.
Get the underlying items from the given collection if applicable.
Create a new instance with no items.
Create a new collection by invoking the callback a given amount of times.
Create a new collection by decoding a JSON string.
Get the average value of a given key.
Alias for the "avg" method.
Alias for the "contains" method.
Execute a callback over each nested chunk of items.
Determine if all items pass the given truth test.
Get the first item by the given key value pair.
Determine if the collection contains multiple items, optionally matching the given criteria.
Get a single key's value from the first matching item in the collection.
Ensure that every item in the collection is of the expected type.
Run a map over each nested chunk of items.
Run a grouping map over the items.
Map a collection and flatten the result by a single level.
Get the min value of a given key.
Get the max value of a given key.
"Paginate" the collection by slicing it into a smaller collection.
Partition the collection into two arrays using the given callback or key.
Calculate the percentage of items that pass a given truth test.
Get the sum of the given values.
Apply the callback if the collection is empty.
Apply the callback if the collection is not empty.
Apply the callback unless the collection is empty.
Apply the callback unless the collection is not empty.
Filter items by the given key value pair.
Filter items where the value for the given key is null.
Filter items where the value for the given key is not null.
Filter items by the given key value pair using strict comparison.
Filter items by the given key value pair.
Filter items by the given key value pair using strict comparison.
Filter items such that the value of the given key is between the given values.
Filter items such that the value of the given key is not between the given values.
Filter items by the given key value pair.
Filter items by the given key value pair using strict comparison.
Filter the items, removing any items that don't match the given type(s).
Pass the collection to the given callback and return the result.
Pass the collection through a series of callable pipes and return the result.
Reduce the collection to a single value.
Reduce the collection to a single value by mutating an initial value.
Reduce the collection to multiple aggregate values.
Reduce an associative collection to a single value.
Create a collection of all elements that do not pass a given truth test.
Pass the collection to the given callback and then return it.
Return only unique items from the collection array.
Return only unique items from the collection array using strict comparison.
Get the collection of items as pretty print formatted JSON.
Get a CachingIterator instance.
Indicate that the model's string representation should be escaped when __toString is invoked.
Add a method to the list of proxied methods.
Flush the registered proxies, restoring the default list.
Results array of items from Collection or Arrayable.
Get an operator checker callback.
Determine if the given value is callable, but not a string.
Get a value retrieving callback.
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Create a new resource collection instance for the given resource.
Guess the resource collection for the items.
Get the resource class from the class attribute.
Get the resource collection class from the class attribute.
Create a collection with the given range.
Collapse the collection of items into a single array while preserving its keys.
Determine if a key exists in the collection.
Determine if an item exists, using strict comparison.
Determine if a key does not exist in the collection.
Determine if an item is not contained in the enumerable, using strict comparison.
Cross join with the given lists, returning all possible permutations.
Get the items in the collection that are not present in the given items, using the callback.
Get the items in the collection whose keys and values are not present in the given items.
Get the items in the collection whose keys and values are not present in the given items, using the callback.
Get the items in the collection whose keys are not present in the given items.
Get the items in the collection whose keys are not present in the given items, using the callback.
Retrieve duplicate items from the collection.
Retrieve duplicate items from the collection using strict comparison.
Get the comparison function to detect duplicates.
Returns all models in the collection except the models with specified keys.
Run a filter over each of the items.
Get the first item from the collection passing the given truth test.
Get an item from the collection by key.
Get an item from the collection by key or add it to collection if it does not exist.
Group an associative array by a field or using a callback.
Key an associative array by a field or using a callback.
Concatenate values of a given key as a string.
Intersect the collection with the given items, using the callback.
Intersect the collection with the given items with additional index check.
Intersect the collection with the given items with additional index check, using the callback.
Intersect the collection with the given items by key.
Join all items from the collection using a string. The final items can use a separate glue string.
Get the last item from the collection.
No description
Run an associative map over each of the items.
Recursively merge the collection with the given items.
Multiply the items in the collection by the multiplier.
Create a collection by using this collection for keys and another for its values.
Create a new collection consisting of every n-th element.
Returns only the models from the collection with the specified keys.
Select specific values from the items within the collection.
Push an item onto the beginning of the collection.
Push one or more items onto the end of the collection.
Prepend one or more items to the beginning of the collection.
Push all of the given items onto the collection.
Get and remove an item from the collection.
Get one or a specified number of items randomly from the collection.
Recursively replace the collection items with the given items.
Search the collection for a given value and return the corresponding key if successful.
Get the item before the given item.
Create chunks representing a "sliding window" view of the items in the collection.
Skip items in the collection until the given condition is met.
Skip items in the collection while the given condition is met.
Slice the underlying collection array.
Split a collection into a certain number of groups.
Split a collection into a certain number of groups, and fill the first groups completely.
Get the first item in the collection, but only if exactly one item exists. Otherwise, throw an exception.
Determine if the collection contains a single item, optionally matching the given criteria.
Get the first item in the collection but throw an exception if no matching items exist.
Chunk the collection into chunks of the given size.
Chunk the collection into chunks with a callback.
Sort through each item with a callback.
Sort the collection using the given callback.
Sort the collection using multiple comparisons.
Sort the collection in descending order using the given callback.
Sort the collection keys.
Sort the collection keys in descending order.
Sort the collection keys using a callback.
Splice a portion of the underlying collection array.
Take items in the collection until the given condition is met.
Take items in the collection while the given condition is met.
Transform each item in the collection using a callback.
Flatten a multi-dimensional associative array with dots.
Get a dictionary key attribute - casting it to a string if necessary.
Find a model in the collection by key.
Find a model in the collection by key or throw an exception.
Load a set of relationships onto the collection.
Load a set of aggregations over relationship's column onto the collection.
Load a set of relationship counts onto the collection.
Load a set of relationship's max column values onto the collection.
Load a set of relationship's min column values onto the collection.
Load a set of relationship's column summations onto the collection.
Load a set of relationship's average column values onto the collection.
Load a set of related existences onto the collection.
Load a set of relationships onto the collection if they are not already eager loaded.
Load a relationship path for models of the given type if it is not already eager loaded.
Load a relationship path if it is not already eager loaded.
Load a set of relationships onto the mixed relationship collection.
Load a set of relationship counts onto the mixed relationship collection.
Reload a fresh model instance from the database for all the entities.
Make the given, typically visible, attributes hidden across the entire collection.
Merge the given, typically visible, attributes hidden across the entire collection.
Set the hidden attributes across the entire collection.
Make the given, typically hidden, attributes visible across the entire collection.
Merge the given, typically hidden, attributes visible across the entire collection.
Set the visible attributes across the entire collection.
Append an attribute across the entire collection.
Sets the appends on every element of the collection, overwriting the existing appends for each.
Remove appended properties from every element in the collection.
Get a dictionary keyed by primary keys.
Enable relationship autoloading for all models in this collection.
Get the queueable class name for the given model.
Get the connection of the entities being queued.
Mark all notifications as read.
Mark all notifications as unread.
Details
in
Conditionable at line 23
mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) truthy.
in
Conditionable at line 56
mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) falsy.
in
EnumeratesValues at line 125
static EnumeratesValues
make(mixed $items = [], mixed ...$args)
Create a new collection instance if the value isn't one already.
in
EnumeratesValues at line 138
static EnumeratesValues
wrap(mixed $value, mixed ...$args)
Wrap the given value in a collection if applicable.
in
EnumeratesValues at line 154
static mixed
unwrap(mixed $value)
Get the underlying items from the given collection if applicable.
in
EnumeratesValues at line 162
static EnumeratesValues
empty(mixed ...$args)
Create a new instance with no items.
in
EnumeratesValues at line 175
static EnumeratesValues
times(int $number, callable|null $callback = null, mixed ...$args)
Create a new collection by invoking the callback a given amount of times.
in
EnumeratesValues at line 191
static EnumeratesValues
fromJson(string $json, int $depth = 512, int $flags = 0, mixed ...$args)
Create a new collection by decoding a JSON string.
in
EnumeratesValues at line 201
float|int|null
avg(callable|int|string|null $callback = null)
Get the average value of a given key.
in
EnumeratesValues at line 222
float|int|null
average(callable|string|null $callback = null)
Alias for the "avg" method.
in
EnumeratesValues at line 232
bool
some(mixed $key, mixed $operator = null, mixed $value = null)
Alias for the "contains" method.
in
EnumeratesValues at line 240
never
dd(mixed ...$args)
Dump the given arguments and terminate execution.
in
EnumeratesValues at line 248
EnumeratesValues
dump(mixed ...$args)
Dump the items.
in
EnumeratesValues at line 260
EnumeratesValues
each(callable $callback)
Execute a callback over each item.
in
EnumeratesValues at line 276
EnumeratesValues
eachSpread(callable $callback)
Execute a callback over each nested chunk of items.
in
EnumeratesValues at line 290
bool
every(mixed $key, mixed $operator = null, mixed $value = null)
Determine if all items pass the given truth test.
in
EnumeratesValues at line 312
mixed
firstWhere(callable|string $key, mixed $operator = null, mixed $value = null)
Get the first item by the given key value pair.
in
EnumeratesValues at line 322
bool
hasMany(callable|string|null $key = null, mixed $operator = null, mixed $value = null)
Determine if the collection contains multiple items, optionally matching the given criteria.
in
EnumeratesValues at line 343
mixed
value(string $key, mixed $default = null)
Get a single key's value from the first matching item in the collection.
in
EnumeratesValues at line 362
EnumeratesValues
ensure(string|array $type)
Ensure that every item in the collection is of the expected type.
in
EnumeratesValues at line 391
bool
isNotEmpty()
Determine if the collection is not empty.
in
EnumeratesValues at line 404
EnumeratesValues
mapSpread(callable $callback)
Run a map over each nested chunk of items.
in
EnumeratesValues at line 424
EnumeratesValues
mapToGroups(callable $callback)
Run a grouping map over the items.
The callback should return an associative array with a single key/value pair.
in
EnumeratesValues at line 443
TFlatMapValue>
flatMap(callable $callback)
Map a collection and flatten the result by a single level.
No return type: Eloquent\Collection::collapse() returns base collection,
which would violate : static when called on Eloquent\Collection.
in
EnumeratesValues at line 456
TMapIntoValue>
mapInto(string $class)
Map the values into a new class.
in
EnumeratesValues at line 473
mixed
min(callable|int|string|null $callback = null)
Get the min value of a given key.
in
EnumeratesValues at line 490
mixed
max(callable|int|string|null $callback = null)
Get the max value of a given key.
in
EnumeratesValues at line 504
EnumeratesValues
forPage(int $page, int $perPage)
"Paginate" the collection by slicing it into a smaller collection.
in
EnumeratesValues at line 517
TValue>>
partition(mixed $key, mixed $operator = null, mixed $value = null)
Partition the collection into two arrays using the given callback or key.
in
EnumeratesValues at line 534
float|null
percentage(callable $callback, int $precision = 2)
Calculate the percentage of items that pass a given truth test.
in
EnumeratesValues at line 554
mixed
sum(callable|int|string|null $callback = null)
Get the sum of the given values.
in
EnumeratesValues at line 572
mixed
whenEmpty(callable $callback, callable|null $default = null)
Apply the callback if the collection is empty.
in
EnumeratesValues at line 586
mixed
whenNotEmpty(callable $callback, callable|null $default = null)
Apply the callback if the collection is not empty.
in
EnumeratesValues at line 600
mixed
unlessEmpty(callable $callback, callable|null $default = null)
Apply the callback unless the collection is empty.
in
EnumeratesValues at line 614
mixed
unlessNotEmpty(callable $callback, callable|null $default = null)
Apply the callback unless the collection is not empty.
in
EnumeratesValues at line 622
EnumeratesValues
where(callable|string|null $key, mixed $operator = null, mixed $value = null)
Filter items by the given key value pair.
in
EnumeratesValues at line 630
EnumeratesValues
whereNull(string|null $key = null)
Filter items where the value for the given key is null.
in
EnumeratesValues at line 638
EnumeratesValues
whereNotNull(string|null $key = null)
Filter items where the value for the given key is not null.
in
EnumeratesValues at line 646
EnumeratesValues
whereStrict(callable|string|null $key, mixed $value)
Filter items by the given key value pair using strict comparison.
in
EnumeratesValues at line 654
EnumeratesValues
whereIn(string $key, Arrayable|iterable $values, bool $strict = false)
Filter items by the given key value pair.
in
EnumeratesValues at line 664
EnumeratesValues
whereInStrict(string $key, Arrayable|iterable $values)
Filter items by the given key value pair using strict comparison.
in
EnumeratesValues at line 672
EnumeratesValues
whereBetween(string $key, Arrayable|iterable $values)
Filter items such that the value of the given key is between the given values.
in
EnumeratesValues at line 680
EnumeratesValues
whereNotBetween(string $key, Arrayable|iterable $values)
Filter items such that the value of the given key is not between the given values.
in
EnumeratesValues at line 690
EnumeratesValues
whereNotIn(string $key, Arrayable|iterable $values, bool $strict = false)
Filter items by the given key value pair.
in
EnumeratesValues at line 700
EnumeratesValues
whereNotInStrict(string $key, Arrayable|iterable $values)
Filter items by the given key value pair using strict comparison.
in
EnumeratesValues at line 713
EnumeratesValues
whereInstanceOf(string|array $type)
Filter the items, removing any items that don't match the given type(s).
in
EnumeratesValues at line 739
mixed
pipe(callable $callback)
Pass the collection to the given callback and return the result.
in
EnumeratesValues at line 752
mixed
pipeInto(string $class)
Pass the collection into a new class.
in
EnumeratesValues at line 762
mixed
pipeThrough(array $callbacks)
Pass the collection through a series of callable pipes and return the result.
in
EnumeratesValues at line 780
mixed
reduce(callable $callback, mixed $initial = null)
Reduce the collection to a single value.
in
EnumeratesValues at line 800
mixed
reduceInto(mixed $initial, callable $callback)
Reduce the collection to a single value by mutating an initial value.
in
EnumeratesValues at line 814
array
reduceSpread(callable $callback, mixed ...$initial)
Reduce the collection to multiple aggregate values.
in
EnumeratesValues at line 843
mixed
reduceWithKeys(callable $callback, mixed $initial = null)
Reduce an associative collection to a single value.
in
EnumeratesValues at line 853
EnumeratesValues
reject(mixed $callback = true)
Create a collection of all elements that do not pass a given truth test.
in
EnumeratesValues at line 869
EnumeratesValues
tap(callable $callback)
Pass the collection to the given callback and then return it.
in
EnumeratesValues at line 881
EnumeratesValues
unique(callable|int|string|null $key = null, bool $strict = false)
Return only unique items from the collection array.
in
EnumeratesValues at line 901
EnumeratesValues
uniqueStrict(callable|string|null $key = null)
Return only unique items from the collection array using strict comparison.
in
EnumeratesValues at line 911
Collection
collect()
Collect the values into a collection.
in
EnumeratesValues at line 921
array
toArray()
Get the collection of items as a plain array.
in
EnumeratesValues at line 931
array
jsonSerialize()
Convert the object into something JSON serializable.
in
EnumeratesValues at line 946
string
toJson(int $options = 0)
Get the collection of items as JSON.
in
EnumeratesValues at line 954
string
toPrettyJson(int $options = 0)
Get the collection of items as pretty print formatted JSON.
in
EnumeratesValues at line 962
CachingIterator
getCachingIterator(int $flags = CachingIterator::CALL_TOSTRING)
Get a CachingIterator instance.
in
EnumeratesValues at line 971
string
__toString()
Convert the collection to its string representation.
in
EnumeratesValues at line 981
EnumeratesValues
escapeWhenCastingToString(bool $escape = true)
Indicate that the model's string representation should be escaped when __toString is invoked.
in
EnumeratesValues at line 995
static void
proxy(string $method)
Add a method to the list of proxied methods.
Boot or tests only. The method is registered on a worker-wide static and applies to every subsequent collection access; per-request use races across coroutines.
in
EnumeratesValues at line 1006
static void
flushProxies()
Flush the registered proxies, restoring the default list.
Boot or tests only. Resets the worker-wide proxy registry; concurrent coroutines may resolve different proxies depending on timing.
in
EnumeratesValues at line 1016
mixed
__get(string $key)
Dynamically access collection proxies.
in
EnumeratesValues at line 1030
protected array
getArrayableItems(mixed $items)
Results array of items from Collection or Arrayable.
in
EnumeratesValues at line 1040
protected callable
operatorForWhere(callable|string|null $key, mixed $operator = null, mixed $value = null)
Get an operator checker callback.
in
EnumeratesValues at line 1094
protected bool
useAsCallable(mixed $value)
Determine if the given value is callable, but not a string.
in
EnumeratesValues at line 1102
protected callable
valueRetriever(callable|int|string|null $value)
Get a value retrieving callback.
in
EnumeratesValues at line 1116
protected Closure
equality(mixed $value)
Make a function to check an item's equality.
in
EnumeratesValues at line 1124
protected Closure
negate(Closure $callback)
Make a function using another function, by negating its result.
in
EnumeratesValues at line 1134
protected Closure
identity()
Make a function that returns what's passed to it.
in
Macroable at line 28
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 41
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 57
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 68
static void
flushMacros()
Flush the existing macros.
Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 78
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 103
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
in
TransformsToResourceCollection at line 25
ResourceCollection
toResourceCollection(string|null $resourceClass = null)
Create a new resource collection instance for the given resource.
in
TransformsToResourceCollection at line 39
protected ResourceCollection
guessResourceCollection()
Guess the resource collection for the items.
in
TransformsToResourceCollection at line 92
protected string|null
resolveResourceFromAttribute(string $class)
Get the resource class from the class attribute.
in
TransformsToResourceCollection at line 111
protected string|null
resolveResourceCollectionFromAttribute(string $class)
Get the resource collection class from the class attribute.
in
Collection at line 51
__construct(null|TValue>|TValue> $items = [])
Create a new collection.
in
Collection at line 65
protected Collection
newInstance(mixed $items = [])
Create a new instance of the collection.
in
Collection at line 75
static Enumerable
range(int $from, int $to, int $step = 1, mixed ...$args)
Create a collection with the given range.
in
Collection at line 85
array
all()
Get all of the items in the collection.
in
Collection at line 95
LazyCollection
lazy()
Get a lazy collection for the items in this collection.
in
Collection at line 105
float|int|null
median(string|array|null $key = null)
Get the median of a given key.
in
Collection at line 134
array|null
mode(string|array|null $key = null)
Get the mode of a given key.
in
Collection at line 679
static<int, mixed>
collapse()
No description
in
Collection at line 170
Collection
collapseWithKeys()
Collapse the collection of items into a single array while preserving its keys.
in
Collection at line 337
bool
contains(mixed $key, mixed $operator = null, mixed $value = null)
Determine if a key exists in the collection.
in
Collection at line 219
bool
containsStrict(mixed $key, mixed $value = null)
Determine if an item exists, using strict comparison.
in
Collection at line 358
bool
doesntContain(mixed $key, mixed $operator = null, mixed $value = null)
Determine if a key does not exist in the collection.
in
Collection at line 243
bool
doesntContainStrict(mixed $key, mixed $operator = null, mixed $value = null)
Determine if an item is not contained in the enumerable, using strict comparison.
in
Collection at line 257
Enumerable
crossJoin(Arrayable|iterable ...$lists)
Cross join with the given lists, returning all possible permutations.
in
Collection at line 458
Enumerable
diff(mixed $items)
Diff the collection with the given items.
in
Collection at line 281
Enumerable
diffUsing(mixed $items, callable $callback)
Get the items in the collection that are not present in the given items, using the callback.
in
Collection at line 291
Enumerable
diffAssoc(Arrayable|iterable $items)
Get the items in the collection whose keys and values are not present in the given items.
in
Collection at line 302
Enumerable
diffAssocUsing(Arrayable|iterable $items, callable $callback)
Get the items in the collection whose keys and values are not present in the given items, using the callback.
in
Collection at line 312
Enumerable
diffKeys(Arrayable|iterable $items)
Get the items in the collection whose keys are not present in the given items.
in
Collection at line 323
Enumerable
diffKeysUsing(Arrayable|iterable $items, callable $callback)
Get the items in the collection whose keys are not present in the given items, using the callback.
in
Collection at line 335
Enumerable
duplicates(callable|string|null $callback = null, bool $strict = false)
Retrieve duplicate items from the collection.
in
Collection at line 363
Enumerable
duplicatesStrict(callable|string|null $callback = null)
Retrieve duplicate items from the collection using strict comparison.
in
Collection at line 759
protected callable
duplicateComparator(bool $strict)
Get the comparison function to detect duplicates.
in
Collection at line 536
Enumerable
except(mixed $keys)
Returns all models in the collection except the models with specified keys.
in
Collection at line 407
Enumerable
filter(callable|null $callback = null)
Run a filter over each of the items.
in
Collection at line 425
mixed
first(callable|null $callback = null, mixed $default = null)
Get the first item from the collection passing the given truth test.
in
Collection at line 688
static<int, mixed>
flatten(int|float $depth = INF)
No description
in
Collection at line 697
TKey>
flip()
No description
in
Collection at line 457
Collection
forget(mixed $keys)
Remove an item from the collection by key.
in
Collection at line 475
mixed
get(mixed $key, mixed $default = null)
Get an item from the collection by key.
in
Collection at line 494
mixed
getOrPut(mixed $key, mixed $value)
Get an item from the collection by key or add it to collection if it does not exist.
in
Collection at line 519
Enumerable
groupBy(callable|array|string $groupBy, bool $preserveKeys = false)
Group an associative array by a field or using a callback.
in
Collection at line 574
Enumerable
keyBy(callable|array|string $keyBy)
Key an associative array by a field or using a callback.
in
Collection at line 600
bool
has(mixed $key)
Determine if an item exists in the collection by key.
in
Collection at line 612
bool
hasAny(mixed $key)
Determine if any of the keys exist in the collection.
in
Collection at line 628
string
implode(callable|string|null $value, string|null $glue = null)
Concatenate values of a given key as a string.
in
Collection at line 479
Enumerable
intersect(mixed $items)
Intersect the collection with the given items.
in
Collection at line 659
Enumerable
intersectUsing(mixed $items, callable $callback)
Intersect the collection with the given items, using the callback.
in
Collection at line 669
Enumerable
intersectAssoc(mixed $items)
Intersect the collection with the given items with additional index check.
in
Collection at line 680
Enumerable
intersectAssocUsing(mixed $items, callable $callback)
Intersect the collection with the given items with additional index check, using the callback.
in
Collection at line 690
Enumerable
intersectByKeys(mixed $items)
Intersect the collection with the given items by key.
in
Collection at line 707
bool
isEmpty()
Determine if the collection is empty or not.
in
Collection at line 717
string
join(string $glue, string $finalGlue = '')
Join all items from the collection using a string. The final items can use a separate glue string.
in
Collection at line 706
TKey>
keys()
No description
in
Collection at line 759
mixed
last(callable|null $callback = null, mixed $default = null)
Get the last item from the collection.
in
Collection at line 737
static<array-key, mixed>
pluck(Closure|string|int|array|null $value, Closure|string|int|array|null $key = null)
No description
in
Collection at line 400
TMapValue>
map(callable $callback)
Run a map over each of the items.
in
Collection at line 800
Enumerable
mapToDictionary(callable $callback)
Run a dictionary map over the items.
The callback should return an associative array with a single key/value pair.
in
Collection at line 420
TMapWithKeysValue>
mapWithKeys(callable $callback)
Run an associative map over each of the items.
The callback should return an associative array with a single key / value pair.
in
Collection at line 380
Enumerable
merge(mixed $items)
Merge the collection with the given items.
in
Collection at line 858
Enumerable
mergeRecursive(mixed $items)
Recursively merge the collection with the given items.
in
Collection at line 866
Collection
multiply(int $multiplier)
Multiply the items in the collection by the multiplier.
in
Collection at line 886
Enumerable
combine(Arrayable|iterable $values)
Create a collection by using this collection for keys and another for its values.
in
Collection at line 896
Enumerable
union(mixed $items)
Union the collection with the given items.
in
Collection at line 908
Enumerable
nth(int $step, int $offset = 0)
Create a new collection consisting of every n-th element.
in
Collection at line 519
Enumerable
only(mixed $keys)
Returns only the models from the collection with the specified keys.
in
Collection at line 954
Collection
select(mixed $keys)
Select specific values from the items within the collection.
in
Collection at line 974
mixed
pop(int $count = 1)
Get and remove the last N items from the collection.
in
Collection at line 1006
Collection
prepend(mixed $value, mixed $key = null)
Push an item onto the beginning of the collection.
in
Collection at line 1019
Collection
push(mixed ...$values)
Push one or more items onto the end of the collection.
in
Collection at line 1034
Collection
unshift(mixed ...$values)
Prepend one or more items to the beginning of the collection.
in
Collection at line 1050
Enumerable
concat(iterable $source)
Push all of the given items onto the collection.
in
Collection at line 1070
mixed
pull(mixed $key, mixed $default = null)
Get and remove an item from the collection.
in
Collection at line 1082
Collection
put(mixed $key, mixed $value)
Put an item in the collection by key.
in
Collection at line 1097
mixed
random(callable|int|string|null $number = null, bool $preserveKeys = false)
Get one or a specified number of items randomly from the collection.
in
Collection at line 1115
Enumerable
replace(mixed $items)
Replace the collection items with the given items.
in
Collection at line 1125
Enumerable
replaceRecursive(mixed $items)
Recursively replace the collection items with the given items.
in
Collection at line 1133
Enumerable
reverse()
Reverse items order.
in
Collection at line 1144
mixed
search(mixed $value, bool $strict = false)
Search the collection for a given value and return the corresponding key if successful.
in
Collection at line 1159
mixed
before(mixed $value, bool $strict = false)
Get the item before the given item.
in
Collection at line 1182
mixed
after(mixed $value, bool $strict = false)
Get the item after the given item.
in
Collection at line 1207
mixed
shift(int $count = 1)
Get and remove the first N items from the collection.
in
Collection at line 1240
Enumerable
shuffle()
Shuffle the items in the collection.
in
Collection at line 1254
Enumerable
sliding(int $size = 2, int $step = 1)
Create chunks representing a "sliding window" view of the items in the collection.
in
Collection at line 1272
Enumerable
skip(int $count)
Skip the first {$count} items.
in
Collection at line 1282
Enumerable
skipUntil(mixed $value)
Skip items in the collection until the given condition is met.
in
Collection at line 1292
Enumerable
skipWhile(mixed $value)
Skip items in the collection while the given condition is met.
in
Collection at line 1300
Enumerable
slice(int $offset, int|null $length = null)
Slice the underlying collection array.
in
Collection at line 1312
Enumerable
split(int $numberOfGroups)
Split a collection into a certain number of groups.
in
Collection at line 1354
Enumerable
splitIn(int $numberOfGroups)
Split a collection into a certain number of groups, and fill the first groups completely.
in
Collection at line 1372
mixed
sole(callable|string|null $key = null, mixed $operator = null, mixed $value = null)
Get the first item in the collection, but only if exactly one item exists. Otherwise, throw an exception.
in
Collection at line 1398
bool
hasSole(callable|string|null $key = null, mixed $operator = null, mixed $value = null)
Determine if the collection contains a single item, optionally matching the given criteria.
in
Collection at line 1418
mixed
firstOrFail(callable|string|null $key = null, mixed $operator = null, mixed $value = null)
Get the first item in the collection but throw an exception if no matching items exist.
in
Collection at line 1440
Enumerable
chunk(int $size, bool $preserveKeys = true)
Chunk the collection into chunks of the given size.
in
Collection at line 1461
Enumerable
chunkWhile(callable $callback)
Chunk the collection into chunks with a callback.
in
Collection at line 1489
Enumerable
sort(callable|int|null $callback = null)
Sort through each item with a callback.
in
Collection at line 1503
Enumerable
sortDesc(int $options = SORT_REGULAR)
Sort items in descending order.
in
Collection at line 1517
Enumerable
sortBy(array|callable|int|string $callback, int $options = SORT_REGULAR, SortDirection|bool $descending = false)
Sort the collection using the given callback.
in
Collection at line 1554
protected Collection
sortByMany(array $comparisons = [], int $options = SORT_REGULAR)
Sort the collection using multiple comparisons.
in
Collection at line 1612
Enumerable
sortByDesc(array|callable|int|string $callback, int $options = SORT_REGULAR)
Sort the collection in descending order using the given callback.
in
Collection at line 1630
Enumerable
sortKeys(int $options = SORT_REGULAR, SortDirection|bool $descending = false)
Sort the collection keys.
in
Collection at line 1645
Enumerable
sortKeysDesc(int $options = SORT_REGULAR)
Sort the collection keys in descending order.
in
Collection at line 1655
Enumerable
sortKeysUsing(callable $callback)
Sort the collection keys using a callback.
in
Collection at line 1667
Collection
splice(int $offset, int|null $length = null, mixed $replacement = [])
Splice a portion of the underlying collection array.
in
Collection at line 1679
Enumerable
take(int $limit)
Take the first or last {$limit} items.
in
Collection at line 1693
Enumerable
takeUntil(mixed $value)
Take items in the collection until the given condition is met.
in
Collection at line 1703
Enumerable
takeWhile(mixed $value)
Take items in the collection while the given condition is met.
in
Collection at line 1718
Collection
transform(callable $callback)
Transform each item in the collection using a callback.
in
Collection at line 1728
Enumerable
dot(int|float $depth = INF)
Flatten a multi-dimensional associative array with dots.
in
Collection at line 1736
Enumerable
undot()
Convert a flatten "dot" notation array into an expanded array.
in
Collection at line 1770
Enumerable
values()
Reset the keys on the underlying array.
in
Collection at line 748
TValue|TZipValue>>
zip(Arrayable|iterable ...$items)
No description
in
Collection at line 717
TPadValue|TValue>
pad(int $size, mixed $value)
No description
in
Collection at line 1813
Traversable
getIterator()
Get an iterator for the items.
in
Collection at line 1823
int
count()
Count the number of items in the collection.
in
Collection at line 670
static<array-key, int>
countBy(callable|string|null $countBy = null)
No description
in
Collection at line 1845
Collection
add(mixed $item)
Add an item to the collection.
in
Collection at line 1857
Collection
toBase()
Get a base Support collection instance from this collection.
in
Collection at line 1867
bool
offsetExists(TKey $offset)
Determine if an item exists at an offset.
in
Collection at line 1878
mixed
offsetGet(TKey $offset)
Get an item at a given offset.
in
Collection at line 1889
void
offsetSet(null|TKey $offset, TValue $value)
Set the item at a given offset.
in
Collection at line 1903
void
offsetUnset(TKey $offset)
Unset the item at a given offset.
in
Collection at line 1911
static void
flushState()
Flush all static state.
in
InteractsWithDictionary at line 19
protected mixed
getDictionaryKey(mixed $attribute)
Get a dictionary key attribute - casting it to a string if necessary.
in
Collection at line 35
($key is mixed[]|TFindDefault|TModel)
find(mixed $key, TFindDefault $default = null)
Find a model in the collection by key.
in
Collection at line 64
TModel
findOrFail(mixed $key)
Find a model in the collection by key or throw an exception.
in
Collection at line 93
Collection
load(array|string $relations)
Load a set of relationships onto the collection.
in
Collection at line 113
Collection
loadAggregate(array|string $relations, string $column, string|null $function = null)
Load a set of aggregations over relationship's column onto the collection.
in
Collection at line 147
Collection
loadCount(array|string $relations)
Load a set of relationship counts onto the collection.
in
Collection at line 157
Collection
loadMax(array|string $relations, string $column)
Load a set of relationship's max column values onto the collection.
in
Collection at line 167
Collection
loadMin(array|string $relations, string $column)
Load a set of relationship's min column values onto the collection.
in
Collection at line 177
Collection
loadSum(array|string $relations, string $column)
Load a set of relationship's column summations onto the collection.
in
Collection at line 187
Collection
loadAvg(array|string $relations, string $column)
Load a set of relationship's average column values onto the collection.
in
Collection at line 197
Collection
loadExists(array|string $relations)
Load a set of related existences onto the collection.
in
Collection at line 207
Collection
loadMissing(array|string $relations)
Load a set of relationships onto the collection if they are not already eager loaded.
in
Collection at line 245
void
loadMissingRelationshipChain(array $tuples)
Load a relationship path for models of the given type if it is not already eager loaded.
in
Collection at line 274
protected void
loadMissingRelation(Collection $models, array $path)
Load a relationship path if it is not already eager loaded.
in
Collection at line 305
Collection
loadMorph(string $relation, array $relations)
Load a set of relationships onto the mixed relationship collection.
in
Collection at line 320
Collection
loadMorphCount(string $relation, array $relations)
Load a set of relationship counts onto the mixed relationship collection.
in
Collection at line 369
array
modelKeys()
Get the array of primary keys.
in
Collection at line 434
Collection
fresh(array|string $with = [])
Reload a fresh model instance from the database for all the entities.
in
Collection at line 553
Collection
makeHidden(array|string $attributes)
Make the given, typically visible, attributes hidden across the entire collection.
in
Collection at line 564
Collection
mergeHidden(array|string $attributes)
Merge the given, typically visible, attributes hidden across the entire collection.
in
Collection at line 575
Collection
setHidden(array $hidden)
Set the hidden attributes across the entire collection.
in
Collection at line 586
Collection
makeVisible(array|string $attributes)
Make the given, typically hidden, attributes visible across the entire collection.
in
Collection at line 597
Collection
mergeVisible(array|string $attributes)
Merge the given, typically hidden, attributes visible across the entire collection.
in
Collection at line 608
Collection
setVisible(array $visible)
Set the visible attributes across the entire collection.
in
Collection at line 619
Collection
append(array|string $attributes)
Append an attribute across the entire collection.
in
Collection at line 630
Collection
setAppends(array $appends)
Sets the appends on every element of the collection, overwriting the existing appends for each.
in
Collection at line 639
Collection
withoutAppends()
Remove appended properties from every element in the collection.
in
Collection at line 650
array
getDictionary(iterable|null $items = null)
Get a dictionary keyed by primary keys.
in
Collection at line 768
Collection
withRelationshipAutoloading()
Enable relationship autoloading for all models in this collection.
in
Collection at line 786
string|null
getQueueableClass()
Get the type of the entities being queued.
in
Collection at line 806
protected string
getQueueableModelClass(mixed $model)
Get the queueable class name for the given model.
in
Collection at line 818
array
getQueueableIds()
Get the identifiers for all of the entities.
in
Collection at line 832
array
getQueueableRelations()
Get the relationships of the entities being queued.
in
Collection at line 855
string|null
getQueueableConnection()
Get the connection of the entities being queued.
in
Collection at line 879
Builder
toQuery()
Get the Eloquent query builder from the collection.
at line 20
void
markAsRead()
Mark all notifications as read.
at line 28
void
markAsUnread()
Mark all notifications as unread.