Commit e557a343 authored by Jens Segers's avatar Jens Segers

Merge pull request #569 from fungku/master

Allow EmbedsOneOrMany::saveMany to accept a collection
parents ea5ec06d cacdcc1e
......@@ -75,7 +75,7 @@ abstract class Model extends \Jenssegers\Eloquent\Model {
* @param string $localKey
* @param string $foreignKey
* @param string $relation
* @return EmbedsMany
* @return \Jenssegers\Mongodb\Relations\EmbedsMany
*/
protected function embedsMany($related, $localKey = null, $foreignKey = null, $relation = null)
{
......
......@@ -156,15 +156,17 @@ abstract class EmbedsOneOrMany extends Relation {
}
/**
* Attach an array of models to the parent instance.
* Attach a collection of models to the parent instance.
*
* @param array $models
* @return array
* @param \Illuminate\Database\Eloquent\Collection|array $models
* @return \Illuminate\Database\Eloquent\Collection|array
*/
public function saveMany(array $models)
public function saveMany($models)
{
array_walk($models, array($this, 'save'));
foreach ($models as $model) {
$this->save($model);
}
return $models;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment