title: Call to undefined method BinaryFileResponse::header()
body: <p>I have an issue that appeared after updating the Maatwebsite Laravel Package but they are certain it isn't an issue on their package. </p>
  
  <p>I get the following error: Call to undefined method Symfony\Component\HttpFoundation\BinaryFileResponse::header() in my ModifyHeadersMiddleware.php file.</p>
  
  <p>This comes up through the following controller function:</p>
  
  <pre><code>public function summaryReport(){
      return Excel::download(new ClaimsExport, 'claims-report.xlsx');
  }
  </code></pre>
  
  <p>Under which my export is as such:</p>
  
  <pre><code>&lt;?php
  
  namespace App\Exports;
  
  use App\Claim;
  use Maatwebsite\Excel\Concerns\FromView;
  use Maatwebsite\Excel\Concerns\Exportable;
  use Illuminate\Contracts\View\View;
  
  class ClaimsExport implements FromView
  {
      use Exportable;
  
      /**
      * @return \Illuminate\Support\Collection
      */
      public function view(): View
      {
          return view('exports.osd.claims', [
              'claims' =&gt; Claim::where('type',2)-&gt;where('status',1)-&gt;whereNotNull('shipmentID')-&gt;orderBy('claimDate','desc')-&gt;get()
          ]);
      }
  }
  </code></pre>
  
  <p>And this is the section of code that is brought up in the ModifyHeadersMiddle.php file:</p>
  
  <pre><code>   public function handle($request, Closure $next)
  {
      $headers = [
          'Access-Control-Allow-Origin'      =&gt; '*',
          'Access-Control-Allow-Methods'     =&gt; 'POST, GET, OPTIONS',
          'Access-Control-Allow-Credentials' =&gt; 'true',
          'Access-Control-Max-Age'           =&gt; '86400',
          'Access-Control-Allow-Headers'     =&gt; 'Content-Type, Authorization, X-Requested-With'
      ];
  
      if ($request-&gt;isMethod('OPTIONS')) {
          return response()-&gt;json('{"method":"OPTIONS"}', 200, $headers);
      }
  
      $response = $next($request);
      foreach($headers as $key =&gt; $value) {
          $response-&gt;header($key, $value);
      }
  
      return $response;
  }
  </code></pre>
  
  <p>I'd appreciate any help anyone can give. Thank you so much!</p>