public function testOnly() { $expected = array('a' => array('i' => 'ai', 'j' => 'aj'), 'b' => array('i' => 'bi', 'j' => 'bj', 'k' => 'bk'), 'c' => array()); $this->assertEquals($expected, Arr::only($this->input, 'a,b,c')); $expected = array('a' => array('i' => 'ai', 'j' => 'aj'), 'e' => null); $this->assertEquals($expected, Arr::only($this->input, array('a', 'e'), true)); }
public function fields($data = null) { return $data !== null ? Arr::only($data, $this->fields) : $this->fields; }
/** * Filter out an array so that it only contains the specified keys. * @param array $keys * @param bool $force * @return Arr */ public function only($keys, $force = false) { return new self(Arr::only($this->data, $keys, $force)); }