The Collection object implements the ArrayAccess and IteratorAggregate interface, allowing it to be used like an array.
Access collection element:
$collection = collect([1, 2, 3]);
$result = $collection[1];
Result: 2
Assign new element:
$collection = collect([1, 2, 3]);
$collection[] = ...