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 (),
@@ -193,6 +194,40 @@ protected function getAnonymous()
193
194
return $ components ;
194
195
}
195
196
197
+ protected function getVendorComponents (): array
198
+ {
199
+ $ components = [];
200
+
201
+ /** @var \Illuminate\View\Factory $view */
202
+ $ view = \Illuminate \Support \Facades \App::make ('view ' );
203
+
204
+ /** @var \Illuminate\View\FileViewFinder $finder */
205
+ $ finder = $ view ->getFinder ();
206
+
207
+ /** @var array<string, array<int, string>> $views */
208
+ $ views = $ finder ->getHints ();
209
+
210
+ foreach ($ views as $ key => $ paths ) {
211
+ // First is always optional override in the resources/views folder
212
+ $ path = $ paths [0 ].'/components ' ;
213
+
214
+ if (! is_dir ($ path )) {
215
+ continue ;
216
+ }
217
+
218
+ array_push (
219
+ $ components ,
220
+ ...$ this ->findFiles (
221
+ $ path ,
222
+ 'blade.php ' ,
223
+ fn (\Illuminate \Support \Stringable $ k ) => $ k ->kebab ()->prepend ($ key .':: ' ),
224
+ )
225
+ );
226
+ }
227
+
228
+ return $ components ;
229
+ }
230
+
196
231
protected function handleIndexComponents ($ str )
197
232
{
198
233
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(),
@@ -193,6 +194,40 @@ $components = new class {
193
194
return $components;
194
195
}
195
196
197
+ protected function getVendorComponents(): array
198
+ {
199
+ $components = [];
200
+
201
+ /** @var \\Illuminate\\View\\Factory $view */
202
+ $view = \\Illuminate\\Support\\Facades\\App::make('view');
203
+
204
+ /** @var \\Illuminate\\View\\FileViewFinder $finder */
205
+ $finder = $view->getFinder();
206
+
207
+ /** @var array<string, array<int, string>> $views */
208
+ $views = $finder->getHints();
209
+
210
+ foreach ($views as $key => $paths) {
211
+ // First is always optional override in the resources/views folder
212
+ $path = $paths[0].'/components';
213
+
214
+ if (! is_dir($path)) {
215
+ continue;
216
+ }
217
+
218
+ array_push(
219
+ $components,
220
+ ...$this->findFiles(
221
+ $path,
222
+ 'blade.php',
223
+ fn (\\Illuminate\\Support\\Stringable $k) => $k->kebab()->prepend($key.'::'),
224
+ )
225
+ );
226
+ }
227
+
228
+ return $components;
229
+ }
230
+
196
231
protected function handleIndexComponents($str)
197
232
{
198
233
if ($str->endsWith('.index')) {
You can’t perform that action at this time.
0 commit comments