Reputation: 11
Runtime error on AppServiceProvider.php file . Following my code
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
use App\Category;
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()
{
//
}
}
Anybody can help me??
Upvotes: 1
Views: 1033
Reputation: 18187
You're missing the namespace \Illuminate\Support\Facades\View::share()
or
use \Illuminate\Support\Facades\View;
edit
As @d3jn pointed out, the right way is just use View;
.
Upvotes: 2