title: Laravel check middleware for AJAX request
body: <p>Thank you in advance</p>
  <p>I have one middleware that is used to check the user is logged in or not. it is working absolutely fine for synchronous request,</p>
  <p>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</p>
  <p>My middleware looks like below</p>
  <pre><code>public function handle($request, Closure $next)
      {
          if (Helper::checkLogin() != 'success') {
              if ($request-&gt;ajax()) {
                  // Here what i can do?
              }
              return redirect()-&gt;route('splash.screen');
          }
          return $next($request);
      }
  </code></pre>