lbecket
4 months ago
733
3
Laravel

Send response from controller to view with each iteration of a loop

Posted 4 months ago by lbecket

I have a method on a controller that is making an API call and storing the results in a database. The result set can be quite large and so I'm batching the query within a loop. Since the entire process can take several minutes, I would like to alert the user with each iteration, likely in the form of a progress bar built with vue.js.

Is it possible to return data to the view without terminating the method? Or, asked another way, is it possible to change a vue property from within a controller?

Please sign in or create an account to participate in this conversation.