mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-04 12:47:55 +08:00
Update addUpdatedAtColumn() and Fixed ModelBuilderTest
This commit is contained in:
parent
ad8013654c
commit
98981bbaa6
@ -1146,20 +1146,28 @@ class Builder
|
|||||||
/**
|
/**
|
||||||
* Add the "updated at" column to an array of values.
|
* Add the "updated at" column to an array of values.
|
||||||
*
|
*
|
||||||
|
* @param array $values
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function addUpdatedAtColumn(array $values)
|
protected function addUpdatedAtColumn(array $values)
|
||||||
{
|
{
|
||||||
if (! $this->model->usesTimestamps()) {
|
if (! $this->model->usesTimestamps() ||
|
||||||
|
is_null($this->model->getUpdatedAtColumn())) {
|
||||||
return $values;
|
return $values;
|
||||||
}
|
}
|
||||||
|
|
||||||
$column = $this->qualifyColumn($this->model->getUpdatedAtColumn());
|
$column = $this->model->getUpdatedAtColumn();
|
||||||
|
|
||||||
return array_merge(
|
$values = array_merge(
|
||||||
[$column => $this->model->freshTimestampString()],
|
[$column => $this->model->freshTimestampString()],
|
||||||
$values
|
$values
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$values[$this->qualifyColumn($column)] = $values[$column];
|
||||||
|
|
||||||
|
unset($values[$column]);
|
||||||
|
|
||||||
|
return $values;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user