protected function _executeTransaction(callable $worker, $atomic = true)
    {
        if ($atomic) {
            return $this->getConnection()->transactional(function () use ($worker) {
                return $worker();
            });
        }

        return $worker();
    }
protected function _executeTransaction(callable $worker, $atomic = true)
    {
        if ($atomic) {
            return $this->getConnection()->transactional(function () use ($worker) {
                return $worker();
            });
        }

        return $worker();
    }
protected function _executeTransaction ( callable $ worker , $ atomic = true ) { if ( $ atomic ) { return $ this -> getConnection ( ) -> transactional ( function ( ) use ( $ worker ) { return $ worker ( ) ; } ) ; } return $ worker ( ) ; }
Handles the logic executing of a worker inside a transaction.

@param callable $worker The worker that will run inside the transaction.
@param bool $atomic Whether to execute the worker inside a database transaction.
@return mixed
Handles the logic executing of a worker inside a transaction .