Beispiel #1
0
 /**
  * Returns an array of values belonging to a given property of each item in a collection.
  *
  * @param array $collection array
  * @param string $property property
  *
  * @return array|object
  *
  */
 public static function pluck($collection = [], $property = '')
 {
     $plucked = \array_map(function ($value) use($property) {
         return Collections::get($value, $property);
     }, (array) $collection);
     if (Objects::isObject($collection)) {
         $plucked = (object) $plucked;
     }
     return $plucked;
 }