예제 #1
0
 /**
  * @covers ::map
  */
 public function testMap()
 {
     $source = [new Model(['name' => 'test1']), new Model(['name' => 'test1']), new Model(['name' => 'test2'])];
     $models = new Models($source);
     $result = $models->map(function ($model) {
         return $model->name;
     });
     $this->assertEquals(['test1', 'test1', 'test2'], $result);
 }
예제 #2
0
파일: LinkMany.php 프로젝트: harp-orm/core
 /**
  * Call a closure for each model, return the results as an array
  *
  * @param  Closure $closure
  * @return array
  */
 public function map(Closure $closure)
 {
     return $this->current->map($closure);
 }