コード例 #1
0
ファイル: Collection.php プロジェクト: stillat/collection
 /**
  * Get the items with the specified keys.
  *
  * @param  mixed $keys
  *
  * @return static
  */
 public function only($keys)
 {
     $keys = is_array($keys) ? $keys : func_get_args();
     return new static(Arr::only($this->items, $keys));
 }
コード例 #2
0
ファイル: SupportArrTest.php プロジェクト: stillat/collection
 public function testOnly()
 {
     $array = ['name' => 'Desk', 'price' => 100, 'orders' => 10];
     $array = Arr::only($array, ['name', 'price']);
     $this->assertEquals(['name' => 'Desk', 'price' => 100], $array);
 }