diff --git a/src/Illuminate/View/View.php b/src/Illuminate/View/View.php index be51cdc11c59..629b71a1a168 100755 --- a/src/Illuminate/View/View.php +++ b/src/Illuminate/View/View.php @@ -9,6 +9,7 @@ use Illuminate\Support\Str; use Illuminate\Support\MessageBag; use Illuminate\Contracts\View\Engine; +use Illuminate\Support\Traits\Macroable; use Illuminate\Contracts\Support\Arrayable; use Illuminate\Contracts\Support\Renderable; use Illuminate\Contracts\Support\MessageProvider; @@ -16,6 +17,10 @@ class View implements ArrayAccess, ViewContract { + use Macroable { + __call as macroCall; + } + /** * The view factory instance. * @@ -395,6 +400,10 @@ public function __unset($key) */ public function __call($method, $parameters) { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + if (! Str::startsWith($method, 'with')) { throw new BadMethodCallException(sprintf( 'Method %s::%s does not exist.', static::class, $method