title: Difference between before and after middleware in Laravel 5.1
body: <p>The only thing I know is that I have to do this:</p>
  
  <pre><code>$response = $next($request)
  // some logic
  return $response;
  </code></pre>
  
  <p>if I want middleware after the request is handled by the application and also when I use global middlewares, but I have absolutly no clue why I have to do this (I have noticed that I dont have access to $request->user() for example if I dont declare $response variable using global middeware, but I dont know why). Things i cannot understand are:</p>
  
  <ul>
  <li>before/after the request is handled by the application - what does it exactly mean (other than one runs before and second after)?</li>
  <li>How global middlewares defined in protected variable in kernel differs from after middlewares or what they have in common (cause rules during creating handle method are similar)?</li>
  </ul>
  
  <p>I have tried to track down the laravel framework code itself but I think my skills are not enough.</p>