/** * Soft delete the record in the database. * * @return int */ protected function softDelete() { $column = $this->model->getDeletedAtColumn(); return $this->update(array($column => $this->model->freshTimestamp())); }
/** * 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); } }