'why laravel update database asynchronously

my laravel source code and mysql database are on separate server.

there is wired problem and that is database get updated asynchronously.

it does not wait for database got updated and execute the next line.

the job queue is disable and I do not know why this problem happens.

when I add sleep(3) between database update and next line .

it works. it wait 3 seconds and database updates and then next line execute.

please help me??

what does cause it? web server ? database config??

$this->current_row()->update(['status'=>'accepted' ]);
sleep(3) ;
$current= $this->current_row() ;

it works on my local and shared host but it not work on server which database is separate.

at final the row updates but at next line of database update

I need updated row and it does not updated yet

help



Solution 1:[1]

You have to select the row after the update

$current = $this->current_row()
    ->update(['status'=>'accepted' ])
    ->first();

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 Ronak Shah