示例#1
0
 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));
 }
示例#2
0
 public function fields($data = null)
 {
     return $data !== null ? Arr::only($data, $this->fields) : $this->fields;
 }
示例#3
0
 /**
  * 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));
 }