Illuminate\Database\Eloquent\Model::setUpdatedAt PHP Method

setUpdatedAt() public method

Set the value of the "updated at" attribute.
public setUpdatedAt ( mixed $value )
$value mixed
    public function setUpdatedAt($value)
    {
        $this->{static::UPDATED_AT} = $value;
        return $this;
    }

Usage Example

 /**
  * Update the creation and update timestamps.
  *
  * @return void
  */
 protected function updateTimestamps(Model $model)
 {
     // Check if this model uses timestamps first.
     if (!$model->timestamps) {
         return;
     }
     $time = $model->freshTimestamp();
     if (!$model->isDirty(Model::UPDATED_AT)) {
         $model->setUpdatedAt($time);
     }
     if (!$model->exists && !$model->isDirty(Model::CREATED_AT)) {
         $model->setCreatedAt($time);
     }
 }
Model