shaneeqa
shaneeqa

Reputation: 137

Error: Class 'App\Providers\View' not found

I have cloned a laravel project from my friend through GitHub. I've updated (basically installed) composer to the project. After some installation steps, I got the following error.

Error

  Class 'App\Providers\View' not found

  at C:\xampp\htdocs\project\app\Providers\ComposerServiceProvider.php:27
    23|      * @return void
    24|      */
    25|     public function boot()
    26|     {
  > 27|         View::composer(
    28|             'layouts.products', 'App\Http\ViewComposers\viewComposer'
    29|         );
    30|
    31|             View::composer('layouts.products', function ($view) {

  1   C:\xampp\htdocs\project\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:37
      App\Providers\ComposerServiceProvider::boot()

  2   C:\xampp\htdocs\project\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:37
      call_user_func_array([])
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

The project is working fine for my friend, what's the lacking part in the cloned project?

Upvotes: 1

Views: 2955

Answers (1)

mrhn
mrhn

Reputation: 18926

You are missing an include in your class. In your ComposerServiceProvider.php put the following.

use Illuminate\Support\Facades\View;

Upvotes: 3

Related Questions