mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-03 20:27:59 +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.
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user