setAttribute() public method

Set a given attribute on the model.
public setAttribute ( string $key, mixed $value ) : void
$key string
$value mixed
return void
Exemplo n.º 1
0
 /**
  * Attach a model instance to the parent model.
  *
  * @param  \LMongo\Eloquent\Model  $model
  * @return \LMongo\Eloquent\Model
  */
 public function save(Model $model)
 {
     $model->setAttribute($this->foreignKey, new MongoID($this->parent->getKey()));
     return $model->save() ? $model : false;
 }
Exemplo n.º 2
0
 /**
  * Attach a model instance to the parent model.
  *
  * @param  \LMongo\Eloquent\Model  $model
  * @return \LMongo\Eloquent\Model
  */
 public function save(Model $model)
 {
     $model->setAttribute($this->morphType, $this->morphClass);
     return parent::save($model);
 }