Update addUpdatedAtColumn() and Fixed ModelBuilderTest

This commit is contained in:
huangzhhui 2019-01-25 23:22:34 +08:00
parent ad8013654c
commit 98981bbaa6

View File

@ -1146,20 +1146,28 @@ class Builder
/**
* Add the "updated at" column to an array of values.
*
* @param array $values
* @return array
*/
protected function addUpdatedAtColumn(array $values)
{
if (! $this->model->usesTimestamps()) {
if (! $this->model->usesTimestamps() ||
is_null($this->model->getUpdatedAtColumn())) {
return $values;
}
$column = $this->qualifyColumn($this->model->getUpdatedAtColumn());
$column = $this->model->getUpdatedAtColumn();
return array_merge(
$values = array_merge(
[$column => $this->model->freshTimestampString()],
$values
);
$values[$this->qualifyColumn($column)] = $values[$column];
unset($values[$column]);
return $values;
}
/**