Пример #1
0
 /**
  * Get all of the linked models
  *
  * @return Models
  */
 public function getModels()
 {
     $all = new Models();
     foreach ($this->items as $item) {
         $all->addAll($item->getCurrentAndOriginal());
     }
     return $all;
 }
Пример #2
0
 /**
  * @covers ::addAll
  */
 public function testAddAll()
 {
     $models = new Models();
     $model1 = new Model();
     $model2 = new Model();
     $model3 = new Model();
     $models->addAll(new Models());
     $this->assertEmpty($models);
     $models->addAll(new Models([$model1, $model2]));
     $models->addAll(new Models([$model1, $model3]));
     $this->assertCount(3, $models);
     $this->assertSame([$model1, $model2, $model3], Objects::toArray($models->all()));
 }
Пример #3
0
 /**
  * @param  Models   $models
  * @return LinkMany $this
  */
 public function addModels(Models $models)
 {
     $this->current->addAll($models);
     return $this;
 }