Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/Illuminate/Database/Eloquent/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -822,10 +822,15 @@ protected function addUpdatedAtColumn(array $values)
return $values;
}

return Arr::add(
$values, $this->model->getUpdatedAtColumn(),
$this->model->freshTimestampString()
);
if (count($this->getQuery()->joins) > 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like this is the PHP 7.2 break in case joins is e.g. null?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mfn Yep. Fixed in another PR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$column = $this->model->getQualifiedUpdatedAtColumn();
} else {
$column = $this->model->getUpdatedAtColumn();
}

return array_merge($values, [
$column => $this->model->freshTimestampString(),
]);
}

/**
Expand Down
10 changes: 10 additions & 0 deletions src/Illuminate/Database/Eloquent/Concerns/HasTimestamps.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,14 @@ public function getUpdatedAtColumn()
{
return static::UPDATED_AT;
}

/**
* Get the fully qualified "updated at" column.
*
* @return string
*/
public function getQualifiedUpdatedAtColumn()
{
return $this->getTable().'.'.$this->getUpdatedAtColumn();
}
}