Thank you in advance
I have one middleware that is used to check the user is logged in or not. it is working absolutely fine for synchronous request,
For example, the user is logged out, after that they made one ajax request at that time middleware denied access but this is an AJAX request so no redirection will be made. I want to redirect for even AJAX and only wants redirections from middleware
My middleware looks like below
public function handle($request, Closure $next)
{
if (Helper::checkLogin() != 'success') {
if ($request->ajax()) {
// Here what i can do?
}
return redirect()->route('splash.screen');
}
return $next($request);
}