Collection
class Collection
Wrapper for array of models
Mixed models are allowed, but some methods won't work properly
Properties
| protected Model[] | $models |
Methods
__construct(array $models)
Create a new collection from a set of models
int
size()
Return number of models
int
num()
Return number of models
bool
empty()
Return true if empty
each(callable $iterator)
Run function on each model instance (can only modify instance property)
expand(string|array $edges = [], bool $force = false)
Expands nodes within this collection
Details
at line 24
__construct(array $models)
Create a new collection from a set of models
at line 34
Model[]
array()
Return array of models
at line 44
int
size()
Return number of models
at line 55
int
num()
Return number of models
at line 65
bool
empty()
Return true if empty
at line 75
Model|null
get($i = 0)
Return i-th element (if 0 <= i < size)
at line 85
Model|null
first()
Return first element (if exists)
at line 95
Model|null
last()
Return last element (if exists)
at line 142
Collection
each(callable $iterator)
Run function on each model instance (can only modify instance property)
at line 168
Collection
expand(string|array $edges = [], bool $force = false)
Expands nodes within this collection
at line 182
Collection
append(Collection $collection)
Append another collection