Stijn Kluiters Stijn Kluiters - 3 months ago 16
PHP Question

Laravel 5.3, Class cant be found, While the route is correct

I am currently working on view composer:

The problem right now that i have, The route that im calling inside the ComposerServiceProvider.php says that it cant find the route to the ViewComposers/LespakketComposer.php

In the Config\app.php i did add the correct App\Providers\ComposerServiceProvider::class,

Here is my code in ComposerServiceProvider.php

<?php
namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\View;

class ComposerServiceProvider extends ServiceProvider {

/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{

View::composer('*','App\Http\ViewComposer\LespakketComposer');

}

/**
* Register the application services.
*
* @return void
*/
public function register()
{
//
}
}


Here is my error:

ReflectionException in Container.php line 734:
Class App\Http\ViewComposer\LespakketComposer does not exist


The Routes in my folder structure

Does anyone has a solution for my problem?
( The file i am requesting is an Class Indeed )

Answer

You forgot a s:

App\Http\ViewComposers\LespakketComposer