Good afternoon, I am using Laravel 5.6 and I have just applied middleware to my routes, it does the filtering in the following way:
public function handle($request, Closure $next)
{
$tipoUsuario=$this->auth->user()->id_role;
if ($tipoUsuario!=1) {
return view('denied');
}
return $next($request);
}
But the system responds with the error:
Call to a member function setCookie () on null