'How to display results step by step in Laravel 8

I read a Students table in a controller and then return to a view ['students' => $students]. In the view I display information (after a treatment) for each student. In fact the page display when the loop is finished but I would like to display the results one after the other in my loop to show the progress and not all at once ! I tried ajax but the process is slower because the class controller is initialized on each call.

<?php
$Ctrl = new App\Http\Controllers\StudentsController();
$Ctrl->InitInfos();  // read tables and parameters and takes 1 second
?>

@foreach ($students as $student)
    <?php
    $informations = $Ctrl->getInfo($student);  // this takes few seconds
    echo $informations . '<br>';
    ?>
@endforeach


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source