The
collect
function creates a collection instance from the given value:<?php $collection = collect(['taylor', 'abigail']);
<?php public function __construct($config)
{
$this->config = collect($config);
}
<?php return null;
}
return collect($config)
->except('class')
->all();
}
<?php protected function getTrackedResponses()
{
return collect(Cache::get($this->getTrackingKey(), []));
}
<?php protected function eventIsIgnored($event)
{
return collect(config('statamic.api.cache.ignored_events'))->contains(get_class($event));
}
}
<?php public function __construct()
{
$this->data = collect();
$this->supplements = collect();
}
<?php public function __construct()
{
$this->data = collect();
$this->supplements = collect();
}
public function id($id = null)
<?php {
$this->meta = $this->meta();
$this->data = collect($this->meta['data']);
return $this;
}
<?php $files = $this->filesystem()->listContents('/', true);
return collect($files)->keyBy('path');
});
}
<?php private function parseEnv($data)
{
return collect($data)->map(function ($value) {
return Parse::env($value);
})->all();
}
<?php $bardPayload = Arr::get($data, $dottedKey, []);
$changed = collect(Arr::dot($bardPayload))
->filter(function ($value, $key) {
return preg_match('/(.*)\.(type)/', $key) && $value === 'image';
})
<?php $bardPayload = Arr::get($data, $dottedKey, []);
$changed = collect(Arr::dot($bardPayload))
->filter(function ($value, $key) {
return preg_match('/(.*)\.(type)/', $key) && $value === 'link';
})
<?php protected function getKeysFromContainers($containers)
{
return collect($containers)->flatMap(function ($container) {
$keys = $this->store->store($container)->paths()->keys();
return collect($keys)->map(function ($key) use ($container) {
<?php return collect($containers)->flatMap(function ($container) {
$keys = $this->store->store($container)->paths()->keys();
return collect($keys)->map(function ($key) use ($container) {
return "{$container}::{$key}";
});
});
<?php protected function getKeysFromContainersWithWheres($containers, $wheres)
{
return collect($wheres)->reduce(function ($ids, $where) use ($containers) {
$items = collect($containers)->flatMap(function ($collection) use ($where) {
return $this->store->store($collection)
<?php {
return collect($wheres)->reduce(function ($ids, $where) use ($containers) {
$items = collect($containers)->flatMap(function ($collection) use ($where) {
return $this->store->store($collection)
->index($where['column'])->items()
->mapWithKeys(function ($item, $key) use ($collection) {