我正在使用Laravel 8
并且已经安装InertiaJS
,但是在我的目录中resources/views/
我有一个名为的文件index.blade.php
,我计划与InertiaJS
.
默认情况下,InertiaJS
在该目录中查找名为app.blade.php
. 我知道写以下语句:
\Inertia\Inertia::setRootView('index');
更改rootView
并允许我使用我创建的文件。这似乎是一个愚蠢的问题,但据我所知,我可以做两件事..
index.blade.php
为app.blade.php
ServiceProviders
我所拥有的其中一个中我想知道以下几点:
InertiaJS-Laravel
不允许ServiceProvider
使用命令发布php artisan vendor:publish
?(此命令的输出没有显示关于此包的任何要发布的内容)ServiceProvider
like:php artisan make:provider InertiaServiceProvider
然后注册它?ServiceProvider
已经存在的语句之一?像app/Http/Providers/RouteServiceProvider.php
你有什么建议会更好?
我想在我的项目中寻找最大的组织。非常感谢您提前...
我正在使用 来Symfony Finder
获取具有特定扩展名的所有文件以及特定目录中的所有目录。
\n protected function getDirectoryContent(string $directory): array\n {\n $finder = Finder::create()\n ->in($directory)\n ->depth(0)\n ->name(['*.json', '*.php'])\n ->sortByName();\n\n return iterator_to_array($finder, true);\n }\n\n
Run Code Online (Sandbox Code Playgroud)\n这样,该方法只返回所有具有扩展名.php
或.json
在某个目录内的文件。例如,我正在查看的目录结构如下:
/my/directory/\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 A\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 A.JSON\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 anotherfile.kas\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 file0.ds\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 file1.json\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 file2.php\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 file3.php\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 B\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 C\n
Run Code Online (Sandbox Code Playgroud)\nA
、B
和C
是目录。
当我将上面的内容directory path
作为$directory
参数传递到上面所示的方法中时,我得到一个包含以下元素的数组:
file1.json\nfile2.php\nfile3.php\n
Run Code Online (Sandbox Code Playgroud)\n太棒了!但我的问题是,我怎样才能将所有这些添加directories
到结果数组中?我的期望是得到一个如下所示的数组:
A\nB\nC\nfile1.json\nfile2.php\nfile3.php\n
Run Code Online (Sandbox Code Playgroud)\n