From e56b33a41e37d8df8bd34a12acf30a730fda4268 Mon Sep 17 00:00:00 2001 From: Duilio Palacios Date: Sat, 12 Nov 2016 18:39:32 +0000 Subject: [PATCH] Use force fill to populate the default attributes --- src/Illuminate/Database/Eloquent/Relations/HasOne.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Eloquent/Relations/HasOne.php b/src/Illuminate/Database/Eloquent/Relations/HasOne.php index eda7ca75fe13..00190a0fc2e6 100755 --- a/src/Illuminate/Database/Eloquent/Relations/HasOne.php +++ b/src/Illuminate/Database/Eloquent/Relations/HasOne.php @@ -81,7 +81,7 @@ protected function getDefaultFor(Model $model) if (is_callable($this->withDefault)) { $result = call_user_func($this->withDefault); } elseif (is_array($this->withDefault)) { - $result = $this->related->newInstance($this->withDefault); + $result = $this->related->newInstance()->forceFill($this->withDefault); } elseif ($this->withDefault === true) { $result = $this->related->newInstance(); }