Answers for "Trying to get property 'headers' of non-object Middleware\VerifyCsrfToken.php"

PHP
0

Trying to get property 'headers' of non-object Middleware\VerifyCsrfToken.php

Your middleware must return a Response object, or $next($request). As written, 
when not logged in or when $empl is empty, your middleware is just returning a 
string, not a redirect. Update your returns to:

return route('login');
to
return redirect()->route('login');

respectively.
Posted by: Guest on December-01-2020

Code answers related to "Trying to get property 'headers' of non-object Middleware\VerifyCsrfToken.php"

Browse Popular Code Answers by Language