4

How do I redirect to another page for successfully exporting a laravel view file. I am using Laravel Excel 2.1.20. I researched and I discovered that this can't be done except I redirect first and then download the excel sheet. But I don't know how to do this. Past solutions on this issue have not really been helpful to me.

Here is my controller:

$export = Excel::create('Request for Quote', function($excel) use($item, $request) {
                    $excel->sheet('RFQ 1', function($sheet) use($item, $request) {
                    $sheet->loadView('requests.send_rfq_pdf')
                                ->with('item', $item)
                                ->with('request', $request);
                    });
                })->download('xls');
wahdan
  • 1,208
  • 3
  • 16
  • 26
shekwo
  • 1,411
  • 1
  • 20
  • 50

1 Answers1

-1

As the normal function you can use return view to what eve the blade template you wanna redirect.

return view(yourView);

or

return redirect()->route('login');

or

return back()->withInput();

I think this will be helpful to you

Thiwanka
  • 97
  • 1
  • 8
  • It does not work. I already know this. What I said in my question is that the page does not redirect after the excel sheet has downloaded. – shekwo Aug 22 '17 at 03:22
  • you can use the redirect method when you finish the excel download in the same function. – Thiwanka Aug 22 '17 at 03:44
  • 1
    This is an answer but I dunno how to implement it - https://stackoverflow.com/questions/25624927/how-do-i-redirect-after-download-in-laravel – shekwo Aug 22 '17 at 03:55