diff --git a/src/Illuminate/View/Factory.php b/src/Illuminate/View/Factory.php index d8d43ed96bf9..55253bf02117 100755 --- a/src/Illuminate/View/Factory.php +++ b/src/Illuminate/View/Factory.php @@ -344,13 +344,13 @@ protected function getExtension($path) */ public function share($key, $value = null) { - if (! is_array($key)) { - return $this->shared[$key] = $value; - } + $keys = is_array($key) ? $key : [$key => $value]; - foreach ($key as $innerKey => $innerValue) { - $this->share($innerKey, $innerValue); + foreach ($keys as $key => $value) { + $this->shared[$key] = $value; } + + return $value; } /**