Search code examples
phplaravellaravel-artisan

How to show cmd line output data in modal view in Laravel


I have a Laravel 5.2 admin page that has a sync button. It calls php artisan sync command that runs for around 10 minutes.

During it's run it echoes out multiple data lines like:

[1] Product name. Progress 100%.
[2] Product two name. Progress 90%
...

This is nice, if I call the sync from console, but I want also to display the same date in the admin page in a a bootstrap like modal similar to this:

enter image description here

so that the moderator can see the exact progress I see, when I run the command directly from the console.

Haw can I accomplish this?

EDIT

enter image description here


Solution

  • I have this idea for "real-time" approach

    • In your sync command, save each message you want to show on model to a text file. With a success signal line on complete process
    • In your admin page. Do a ajax (with interval) to get content in that file. If it catch the success line -> stop interval and clear text file