File tree Expand file tree Collapse file tree 2 files changed +70
-0
lines changed Expand file tree Collapse file tree 2 files changed +70
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ public function all()
19
19
$ this ->getAnonymousNamespaced (),
20
20
$ this ->getAnonymous (),
21
21
$ this ->getAliases (),
22
+ $ this ->getVendorComponents (),
22
23
))->groupBy ('key ' )->map (fn ($ items ) => [
23
24
'isVendor ' => $ items ->first ()['isVendor ' ],
24
25
'paths ' => $ items ->pluck ('path ' )->values (),
@@ -194,6 +195,40 @@ protected function getAnonymous()
194
195
return $ components ;
195
196
}
196
197
198
+ protected function getVendorComponents (): array
199
+ {
200
+ $ components = [];
201
+
202
+ /** @var \Illuminate\View\Factory $view */
203
+ $ view = \Illuminate \Support \Facades \App::make ('view ' );
204
+
205
+ /** @var \Illuminate\View\FileViewFinder $finder */
206
+ $ finder = $ view ->getFinder ();
207
+
208
+ /** @var array<string, array<int, string>> $views */
209
+ $ views = $ finder ->getHints ();
210
+
211
+ foreach ($ views as $ key => $ paths ) {
212
+ // First is always optional override in the resources/views folder
213
+ $ path = $ paths [0 ] . '/components ' ;
214
+
215
+ if (!is_dir ($ path )) {
216
+ continue ;
217
+ }
218
+
219
+ array_push (
220
+ $ components ,
221
+ ...$ this ->findFiles (
222
+ $ path ,
223
+ 'blade.php ' ,
224
+ fn (\Illuminate \Support \Stringable $ k ) => $ k ->kebab ()->prepend ($ key .':: ' ),
225
+ )
226
+ );
227
+ }
228
+
229
+ return $ components ;
230
+ }
231
+
197
232
protected function handleIndexComponents ($ str )
198
233
{
199
234
if ($ str ->endsWith ('.index ' )) {
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ $components = new class {
19
19
$this->getAnonymousNamespaced(),
20
20
$this->getAnonymous(),
21
21
$this->getAliases(),
22
+ $this->getVendorComponents(),
22
23
))->groupBy('key')->map(fn($items) => [
23
24
'isVendor' => $items->first()['isVendor'],
24
25
'paths' => $items->pluck('path')->values(),
@@ -194,6 +195,40 @@ $components = new class {
194
195
return $components;
195
196
}
196
197
198
+ protected function getVendorComponents(): array
199
+ {
200
+ $components = [];
201
+
202
+ /** @var \\Illuminate\\View\\Factory $view */
203
+ $view = \\Illuminate\\Support\\Facades\\App::make('view');
204
+
205
+ /** @var \\Illuminate\\View\\FileViewFinder $finder */
206
+ $finder = $view->getFinder();
207
+
208
+ /** @var array<string, array<int, string>> $views */
209
+ $views = $finder->getHints();
210
+
211
+ foreach ($views as $key => $paths) {
212
+ // First is always optional override in the resources/views folder
213
+ $path = $paths[0] . '/components';
214
+
215
+ if (!is_dir($path)) {
216
+ continue;
217
+ }
218
+
219
+ array_push(
220
+ $components,
221
+ ...$this->findFiles(
222
+ $path,
223
+ 'blade.php',
224
+ fn (\\Illuminate\\Support\\Stringable $k) => $k->kebab()->prepend($key.'::'),
225
+ )
226
+ );
227
+ }
228
+
229
+ return $components;
230
+ }
231
+
197
232
protected function handleIndexComponents($str)
198
233
{
199
234
if ($str->endsWith('.index')) {
You can’t perform that action at this time.
0 commit comments