I'm working on a game.
This is the scenario:
- First player request a challenge
- system will wait
5 seconds
for another request IF
another request does not come, system start a challenge with abot
All three steps have to run in backend and As much as I know, there's some functions like sleep
or usleep
in php that will wait some specific seconds and then continue the code.
In my case I do not want my controller to sleep.
Note:
As you may know, I'm using laravel
.
Does any one experience about this case?
public function start()
{
$game = new \App\Models\Game();
$lastGame = $game->orderBy('id', 'desc')->first();
if( $lastGame->user_one != false && $lastGame->user_two == null )
{
return 'can join';
}
else if( $lastGame->user_one != null && $lastGame->user_two != null )
{
return 'newGameShould Create...';
}
}
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2QAXlwy
via IFTTT
Aucun commentaire:
Enregistrer un commentaire