/** * */ public function testPluck() { $arr = [['foo' => 'bar'], ['foo' => 'baz']]; $this->assertEquals(['bar', 'baz'], Arr::pluck($arr, 'foo')); // $obj1 = new \StdClass(); $obj1->foo = 'bar'; $obj2 = new \StdClass(); $obj2->foo = 'baz'; $arr = [$obj1, $obj2]; $this->assertEquals(['bar', 'baz'], Arr::pluck($arr, 'foo')); }
/** * Returns an array containing only the values of chosen column. * * @access public * @param string $column Column name * @return array */ public function pluck($column) { return Arr::pluck($this->items, $column); }