diff --git a/src/Illuminate/Console/View/Components/Component.php b/src/Illuminate/Console/View/Components/Component.php index 89dd0f3381fd..263d0034ad1f 100644 --- a/src/Illuminate/Console/View/Components/Component.php +++ b/src/Illuminate/Console/View/Components/Component.php @@ -81,12 +81,14 @@ protected function compile($view, $data) protected function mutate($data, $mutators) { foreach ($mutators as $mutator) { + $mutator = new $mutator; + if (is_iterable($data)) { foreach ($data as $key => $value) { - $data[$key] = app($mutator)->__invoke($value); + $data[$key] = $mutator($value); } } else { - $data = app($mutator)->__invoke($data); + $data = $mutator($data); } } diff --git a/src/Illuminate/Console/View/Components/Mutators/EnsureRelativePaths.php b/src/Illuminate/Console/View/Components/Mutators/EnsureRelativePaths.php index 50f42c6fffd3..babd0343d97e 100644 --- a/src/Illuminate/Console/View/Components/Mutators/EnsureRelativePaths.php +++ b/src/Illuminate/Console/View/Components/Mutators/EnsureRelativePaths.php @@ -12,7 +12,7 @@ class EnsureRelativePaths */ public function __invoke($string) { - if (app()->has('path.base')) { + if (function_exists('app') && app()->has('path.base')) { $string = str_replace(base_path().'/', '', $string); }