Symfony \ 组件 \ 调试 \ 异常 \ 致命可抛掷错误 (E_ERROR) 找不到类'AppProvidersView'



AppServiceProvider.php文件上的运行时错误。遵循我的代码

<?php
namespace AppProviders;
use IlluminateSupportServiceProvider;
use IlluminateSupportFacadesSchema;
use AppCategory;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
View::share('name','bitm');
View::composer('frontEnd.includes.menu',function($view){

$publishedCategories = Category::where('publicationStatus',1)->get();
$view->with('publishedCategories',$publishedCategories);
});
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}

有人能帮我吗??

您缺少名称空间IlluminateSupportFacadesView::share()

use IlluminateSupportFacadesView;

编辑

正如@d3jn所指出的,正确的方式就是use View;

最新更新