title: How to send Authorization access_token to request header in Laravel using Middleware
body: <p>I'm Bulid an API Authentication System. Everything I can check using <code>Postman</code> But I want to attach this mark portion <code>(please see the image)</code> that's means the header portion send from my controller or middleware with request header.</p>
  
  <p>How Can I do this Stuff.
  Please see my code sample.</p>
  
  <p>Picture.
  <a href="https://i.stack.imgur.com/8dCTt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8dCTt.png" alt="enter image description here"></a></p>
  
  <p>I try this using a middleware.</p>
  
  <pre><code> public function handle($request, Closure $next)
  {
      $token='Bearer '.$request-&gt;bearerToken();
      $response=$next($request);
      $response-&gt;header('Authorization',$token);
  
      return $response;
  }
  </code></pre>
  
  <p>Registered middleware in Kernal.</p>
  
  <pre><code>protected $middlewareGroups = [
  
      'Header'  =&gt;[
          \App\Http\Middleware\HeaderMiddleware::class
      ],
  ];
  </code></pre>
  
  <p>and my <code>routes\api.php</code></p>
  
  <pre><code>Route::group(['middleware' =&gt; ['auth:api','Header']], function(){
  Route::post('details', 'API\PassportController@details');
  Route::get('test','API\PassportController@test');
  });
  </code></pre>
  
  <p>When I use Middleware it's show this result in Postman.
  <a href="https://i.stack.imgur.com/6ILyq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6ILyq.png" alt="enter image description here"></a></p>