Skip to content

Commit e5398e7

Browse files
authored
[9.x] De-couple Console component from framework (#44864)
* Do not resolve mutator through app * Check if app function exists
1 parent 4846e5f commit e5398e7

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Illuminate/Console/View/Components/Component.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,14 @@ protected function compile($view, $data)
8181
protected function mutate($data, $mutators)
8282
{
8383
foreach ($mutators as $mutator) {
84+
$mutator = new $mutator;
85+
8486
if (is_iterable($data)) {
8587
foreach ($data as $key => $value) {
86-
$data[$key] = app($mutator)->__invoke($value);
88+
$data[$key] = $mutator($value);
8789
}
8890
} else {
89-
$data = app($mutator)->__invoke($data);
91+
$data = $mutator($data);
9092
}
9193
}
9294

src/Illuminate/Console/View/Components/Mutators/EnsureRelativePaths.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class EnsureRelativePaths
1212
*/
1313
public function __invoke($string)
1414
{
15-
if (app()->has('path.base')) {
15+
if (function_exists('app') && app()->has('path.base')) {
1616
$string = str_replace(base_path().'/', '', $string);
1717
}
1818

0 commit comments

Comments
 (0)