From 0302f7c378bd70fbf28e91f2ba03f5afee33a2d2 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Mon, 7 Nov 2022 11:26:21 +0100 Subject: [PATCH 1/2] Do not resolve mutator through app --- src/Illuminate/Console/View/Components/Component.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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); } } From 9bb1c98830e344d38dcbe1b861d710db5bca4b17 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Mon, 7 Nov 2022 11:26:41 +0100 Subject: [PATCH 2/2] Check if app function exists --- .../Console/View/Components/Mutators/EnsureRelativePaths.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); }