Class 未找到 laravel 但存在
Class not found laravel but exists
我正在尝试呈现 PWA 指令,但出现此错误
Error Class 'App\Services\PWA\MetaService' not found
我在AppServiceProvider.php
中有这个
public function boot()
{
Blade::directive('PWA', function (){
return (new App\Services\PWA\MetaService())->render();
});
}
但是 class 存在
这是 class
<?php
namespace App\Services;
class MetaService
{
public function render(): string
{
return "<?php $config = (new \App\Services\PWA\ManifestService)->generate(); echo $__env->make( 'pwa::meta' , ['config' => $config])->render(); ?>";
}
}
并且位于 app/Services/PWA
我和 ManifestService
(undefined class)
有同样的问题
MetaService
class 命名空间必须是 App\Services\PWA
。您指向的路径只是一个文件夹结构,namespace
才是重要的。
我正在尝试呈现 PWA 指令,但出现此错误
Error Class 'App\Services\PWA\MetaService' not found
我在AppServiceProvider.php
public function boot()
{
Blade::directive('PWA', function (){
return (new App\Services\PWA\MetaService())->render();
});
}
但是 class 存在 这是 class
<?php
namespace App\Services;
class MetaService
{
public function render(): string
{
return "<?php $config = (new \App\Services\PWA\ManifestService)->generate(); echo $__env->make( 'pwa::meta' , ['config' => $config])->render(); ?>";
}
}
并且位于 app/Services/PWA
我和 ManifestService
(undefined class)
MetaService
class 命名空间必须是 App\Services\PWA
。您指向的路径只是一个文件夹结构,namespace
才是重要的。