Yazan herkese teşekkürler öncelikle test için şöyle bir yol izleyebilirsiniz.
public function index()
{
DB::beginTransaction();
$key = Key::lockForUpdate()->where('status' , "1")->where('game_id' , 1)->count();
sleep(5);
DB::commit();
return $key;
}
public function index2()
{ DB::beginTransaction();
$key = Key::lockForUpdate()->where('status' , "1")->where('game_id' , 1)->count();
DB::commit();
return $key;
}