/** * append a model to the list and correctly set any fields required to make this re-fetchable through the same list. * * @param \Rhubarb\Stem\Models\Model $model * @return \Rhubarb\Stem\Models\Model|null */ public function append(Model $model) { $result = null; // If the list was filtered make sure that value is set on the model. if ($this->filter !== null) { $result = $this->filter->setFilterValuesOnModel($model); } $model->save(); // Make sure the list has been fetched so we can pop the unique identifier on the end. if ($this->fetched) { $this->uniqueIdentifiers[] = $model->UniqueIdentifier; } return $result === null ? $model : $result; }