src/Console/DuskCommand.php
protected function withDuskEnvironment($callback)
    {
        if (file_exists(base_path($this->duskFile()))) {
            if (file_get_contents(base_path('.env')) !== file_get_contents(base_path($this->duskFile()))) {
                $this->backupEnvironment();
            }

            $this->refreshEnvironment();
        }

        $this->writeConfiguration();

        return tap($callback(), function () {
            $this->removeConfiguration();

            if (file_exists(base_path($this->duskFile())) && file_exists(base_path('.env.backup'))) {
                $this->restoreEnvironment();
            }
        });
    }
protected function withDuskEnvironment($callback)
    {
        if (file_exists(base_path($this->duskFile()))) {
            if (file_get_contents(base_path('.env')) !== file_get_contents(base_path($this->duskFile()))) {
                $this->backupEnvironment();
            }

            $this->refreshEnvironment();
        }

        $this->writeConfiguration();

        return tap($callback(), function () {
            $this->removeConfiguration();

            if (file_exists(base_path($this->duskFile())) && file_exists(base_path('.env.backup'))) {
                $this->restoreEnvironment();
            }
        });
    }
protected function withDuskEnvironment ( $ callback ) { if ( file_exists ( base_path ( $ this -> duskFile ( ) ) ) ) { if ( file_get_contents ( base_path ( '.env' ) ) !== file_get_contents ( base_path ( $ this -> duskFile ( ) ) ) ) { $ this -> backupEnvironment ( ) ; } $ this -> refreshEnvironment ( ) ; } $ this -> writeConfiguration ( ) ; return tap ( $ callback ( ) , function ( ) { $ this -> removeConfiguration ( ) ; if ( file_exists ( base_path ( $ this -> duskFile ( ) ) ) && file_exists ( base_path ( '.env.backup' ) ) ) { $ this -> restoreEnvironment ( ) ; } } ) ; }
Run the given callback with the Dusk configuration files.

@param  \Closure  $callback
@return mixed
Run the given callback with the Dusk configuration files .