diff --git a/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php b/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php index ed8a9b7ba8a1..04862e5d80f7 100644 --- a/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php +++ b/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php @@ -396,7 +396,7 @@ protected function addTimestampsToAttachment(array $record, $exists = false) if ($this->using) { $pivotModel = new $this->using; - $fresh = $fresh->format($pivotModel->getDateFormat()); + $fresh = $pivotModel->fromDateTime($fresh); } if (! $exists && $this->hasPivotColumn($this->createdAt())) {