Md. Palash Alam
Md. Palash Alam

Reputation: 11

Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR) Class 'App\Providers\View' not found

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

Answers (1)

Brian Lee
Brian Lee

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

Related Questions