I have a huge doubt regarding the Laravel framework (5.6) that is related to the operating mode of its controllers. To explain myself in a better way, I will leave an example that I have just put to the test.
I have created a controller called "MultiController" and I have created two functions in it:
public function first()
{
sleep(10);
echo(Carbon::now());
}
public function second()
{
sleep(5);
echo(Carbon::now());
}
In addition, I have created two routes in the file "web.php" in order to execute, in each of them, the functions:
Route::get('/first', 'MultiController@first');
Route::get('/second', 'MultiController@second');
Finally, I served my project with the command:
php artisan serve --host=MI_IP --port=8000
Now, I understand that if from an IP "A" login to miip: 8000 / first and from an IP "B" entry to miip: 8000 / second none of them would have to wait for the process of a function to finish so that they run, but that is just what happens.
If I enter / first and an instant later, another person (from an IP other than mine) enters / second then she must wait 15 seconds (the 10 seconds that my operation takes and the 5 seconds it takes the yours) to see the date that I'm printing on the screen with the echo, which does not make any sense.
Is there any way that one process does not affect the other in this way?