one controller, two methods, both calling the same function to prepare the data?
Jul 9, 2022
8
Level 15
Download or Render view in the same controller
Hello people!
So, maybe I'm going the wrong way here.
I'm building a reports module for my site, and one of the features that I want to include is to be able to download the data in a CSV file.
Now, I do know how to trigger downloads from Inertia, however, I don't want to maintain 2 different controllers, that will look essentially the same (the query would be the exact same one), just that for one I would render the Inertia View, and for the other one I want to send a CSV file (with the same data).
Is there any way to accomplish this? Am I off the track by trying this?
Thanks all!
Level 122
Please or to participate in this conversation.