Laravel Class App \ Http \ Composers \ MainComposer不存在

时间:2016-09-05 22:28:05

标签: php laravel laravel-5.2 laravel-5.1

我是laravel的新人,我需要一些laravel 5的帮助,为什么这个错误呢?错误发生在Composer类和ComposerServiceProvider中 enter image description here

MainComposer类

<?php
namespace App\Htt\Composers;
use Illuminate\Contracts\View\View;
use App\Category;


class MainComposer {
    public function compose(View $view){
        $view->with('categories', Category::all());
    }
}

ComposerServiceProvider.php

 <?php
namespace App\Providers;
use View; // its saing class View does not exist
use Illuminate\Support\ServiceProvider;
class ComposerServiceProvider extends ServiceProvider{
    public function boot(){
        View::composer('*', 'App\Http\Composers\MainComposer');
    }

    public function register(){

    }

}

enter image description here

0 个答案:

没有答案