Skip to content

Commit d65e67f

Browse files
Merge pull request #361 from N1ebieski:Fix-a-bug-with-overrides-vendor-blade-components-#33
Fix a bug with overrides vendor blade components
2 parents aa72ab7 + 35f31db commit d65e67f

File tree

2 files changed

+28
-26
lines changed

2 files changed

+28
-26
lines changed

php-templates/blade-components.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -218,21 +218,22 @@ protected function getVendorComponents(): array
218218
$views = $finder->getHints();
219219

220220
foreach ($views as $key => $paths) {
221-
// First is always optional override in the resources/views folder
222-
$path = $paths[0] . '/components';
221+
foreach ($paths as $path) {
222+
$path .= '/components';
223223

224-
if (!is_dir($path)) {
225-
continue;
226-
}
224+
if (!is_dir($path)) {
225+
continue;
226+
}
227227

228-
array_push(
229-
$components,
230-
...$this->findFiles(
231-
$path,
232-
'blade.php',
233-
fn (\Illuminate\Support\Stringable $k) => $k->kebab()->prepend($key.'::'),
234-
)
235-
);
228+
array_push(
229+
$components,
230+
...$this->findFiles(
231+
$path,
232+
'blade.php',
233+
fn (\Illuminate\Support\Stringable $k) => $k->kebab()->prepend($key.'::'),
234+
)
235+
);
236+
}
236237
}
237238

238239
return $components;

src/templates/blade-components.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -218,21 +218,22 @@ $components = new class {
218218
$views = $finder->getHints();
219219
220220
foreach ($views as $key => $paths) {
221-
// First is always optional override in the resources/views folder
222-
$path = $paths[0] . '/components';
221+
foreach ($paths as $path) {
222+
$path .= '/components';
223223
224-
if (!is_dir($path)) {
225-
continue;
226-
}
224+
if (!is_dir($path)) {
225+
continue;
226+
}
227227
228-
array_push(
229-
$components,
230-
...$this->findFiles(
231-
$path,
232-
'blade.php',
233-
fn (\\Illuminate\\Support\\Stringable $k) => $k->kebab()->prepend($key.'::'),
234-
)
235-
);
228+
array_push(
229+
$components,
230+
...$this->findFiles(
231+
$path,
232+
'blade.php',
233+
fn (\\Illuminate\\Support\\Stringable $k) => $k->kebab()->prepend($key.'::'),
234+
)
235+
);
236+
}
236237
}
237238
238239
return $components;

0 commit comments

Comments
 (0)