类APP \ Http \ ViewComposers \ CompanyComposer不存在

时间:2016-09-09 02:36:08

标签: php laravel-5.2

我是laravel的新人,我需要一些帮助laravel 5.为什么我会收到此错误?错误在Composer类和View conposer中。 这是错误

enter image description here

<?php
namespace App\Providers;

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

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
     public function boot()
     {
        View::composer(
            'index','APP\Http\ViewComposers\CompanyComposer'
        );
    }
}


<?php

namespace App\Http\ViewComposers;

use Illuminate\Contracts\View\View;

class CompanyComposer
{
    /**
     *
     * @param View $view
     * @return void
     */
    public function compose(View $view)
    {
        //here is data
        $view->with('success', 'success');
    }
}

enter image description here

0 个答案:

没有答案