Skip to content

Commit f5043e3

Browse files
committed
Fix Inertia paths to views
Fixes N1ebieski#17
1 parent b7155f4 commit f5043e3

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

php-templates/inertia.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
$config = config('inertia.testing', []);
44

5-
$pagePaths = collect($config['page_paths'] ?? [])->map(function($path) {
6-
return LaravelVsCode::relativePath($path);
7-
});
5+
$pagePaths = collect($config['page_paths'] ?? [])->flatMap(function($path) {
6+
$relativePath = LaravelVsCode::relativePath($path);
7+
8+
// Folder with inertia pages views is usually uppercase (resources/js/Pages),
9+
// but Laravel starter kits use lowercase (resources/js/pages)
10+
return [$relativePath, mb_strtolower($relativePath)];
11+
})->unique();
812

913
$config['page_paths'] = $pagePaths->toArray();
1014

src/templates/inertia.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
export default `
33
$config = config('inertia.testing', []);
44
5-
$pagePaths = collect($config['page_paths'] ?? [])->map(function($path) {
6-
return LaravelVsCode::relativePath($path);
7-
});
5+
$pagePaths = collect($config['page_paths'] ?? [])->flatMap(function($path) {
6+
$relativePath = LaravelVsCode::relativePath($path);
7+
8+
// Folder with inertia pages views is usually uppercase (resources/js/Pages),
9+
// but Laravel starter kits use lowercase (resources/js/pages)
10+
return [$relativePath, mb_strtolower($relativePath)];
11+
})->unique();
812
913
$config['page_paths'] = $pagePaths->toArray();
1014

0 commit comments

Comments
 (0)