我想在所有视图中共享channel变量但是当我在App服务提供者启动函数中添加view :: share方法时,它向我显示未找到视图类的错误我正在共享代码并且错误请帮助
<?php
namespace App\Providers;
use view;
use App\Channel;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
view::share('channels',Channel::all());
Schema::defaultStringLength(191);
}