Tenter de lire la propriété "En-têtes" sur chaîne

Well in my case, the error happened in my middleware called 
AuthenticationMiddleware when i tried the example below:

I was giving a return of a response without using the Response method. 

Error : return "Welcome, " . $request->session()->get('user')->name

Solution: return Response("Welcome, " . $request->session()->get('user')->name);
Wide-eyed Wolf