Laravel 5.3,无法找到类,但路线正确

时间:2016-09-07 16:53:00

标签: php laravel-5.3

我目前正致力于view composer

我现在遇到的问题,我在ComposerServiceProvider.php中调用的路径说它无法找到到ViewComposers / LespakketComposer.php的路径

在Config \ app.php中我添加了正确的App \ Providers \ ComposerServiceProvider :: class,

这是我在ComposerServiceProvider.php中的代码

<?php
namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\View;

class ComposerServiceProvider extends ServiceProvider {

    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {

        View::composer('*','App\Http\ViewComposer\LespakketComposer');

    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

这是我的错误:

ReflectionException in Container.php line 734:
Class App\Http\ViewComposer\LespakketComposer does not exist

The Routes in my folder structure

有没有人能解决我的问题? (我要求的文件是 Class 确实)

1 个答案:

答案 0 :(得分:0)

您忘记了s

App\Http\ViewComposers\LespakketComposer