Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga committed May 29, 2024
1 parent 71b25c1 commit c284766
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 305 deletions.
35 changes: 0 additions & 35 deletions src/Modifiers/CoreModifiers.php
Original file line number Diff line number Diff line change
Expand Up @@ -1816,41 +1816,6 @@ public function pluck($value, $params)
return $wasArray ? $items->all() : $items;
}

/**
* Selects certain values from each item in a collection.
*
* @param array|Collection $value
* @param array $params
* @return array|Collection
*/
public function select($value, $params)
{
$keys = Arr::wrap($params);

if ($wasArray = is_array($value)) {
$value = collect($value);
}

if (Compare::isQueryBuilder($value)) {
$value = $value->get();
}

$items = $value->map(function ($item) use ($keys) {
return collect($keys)->mapWithKeys(function ($key) use ($item) {
$value = null;
if (is_array($item) || $item instanceof ArrayAccess) {
$value = Arr::get($item, $key);
} else {
$value = method_exists($item, 'value') ? $item->value($key) : $item->get($key);
}

return [$key => $value];
})->all();
});

return $wasArray ? $items->all() : $items;
}

/**
* Get the plural form of an English word with access to $context.
*
Expand Down
270 changes: 0 additions & 270 deletions tests/Modifiers/SelectTest.php

This file was deleted.

0 comments on commit c284766

Please sign in to comment.