Class 'App\Http\Controllers\Session' not found in Laravel 5.2 [duplicate] Class 'App\Http\Controllers\Session' not found in Laravel 5.2 [duplicate] laravel laravel

Class 'App\Http\Controllers\Session' not found in Laravel 5.2 [duplicate]


From the error message:

Class 'App\Http\Controllers\Session' not found

I see that Laravel is searching the Session class in the current namespace: App\Http\Controllers

The problem is you don't have aliased the class from the global namespace: Session is a Facade, and all the facades are in the global namespace

To use the class from the global namespace, put:

use Session;

on top of your controller, after your namespace declaration

Alternatively, you can call the class from the global namespace with:

\Session::get('panier');