function createCa()
    {
        $caPemPath = $this->caPath().'/LaravelValetCASelfSigned.pem';
        $caKeyPath = $this->caPath().'/LaravelValetCASelfSigned.key';

        if ($this->files->exists($caKeyPath) && $this->files->exists($caPemPath)) {
            return;
        }

        $oName = 'Laravel Valet CA Self Signed Organization';
        $cName = 'Laravel Valet CA Self Signed CN';

        if ($this->files->exists($caKeyPath)) {
            $this->files->unlink($caKeyPath);
        }
        if ($this->files->exists($caPemPath)) {
            $this->files->unlink($caPemPath);
        }

        $this->cli->run(sprintf(
            'sudo security delete-certificate -c "%s" /Library/Keychains/System.keychain',
            $cName
        ));

        $this->cli->runAsUser(sprintf(
            'openssl req -new -newkey rsa:2048 -days 730 -nodes -x509 -subj "/C=/ST=/O=%s/localityName=/commonName=%s/organizationalUnitName=Developers/emailAddress=%s/" -keyout "%s" -out "%s"',
            $oName, $cName, 'rootcertificate@laravel.valet', $caKeyPath, $caPemPath
        ));
        $this->trustCa($caPemPath);
    }
function createCa()
    {
        $caPemPath = $this->caPath().'/LaravelValetCASelfSigned.pem';
        $caKeyPath = $this->caPath().'/LaravelValetCASelfSigned.key';

        if ($this->files->exists($caKeyPath) && $this->files->exists($caPemPath)) {
            return;
        }

        $oName = 'Laravel Valet CA Self Signed Organization';
        $cName = 'Laravel Valet CA Self Signed CN';

        if ($this->files->exists($caKeyPath)) {
            $this->files->unlink($caKeyPath);
        }
        if ($this->files->exists($caPemPath)) {
            $this->files->unlink($caPemPath);
        }

        $this->cli->run(sprintf(
            'sudo security delete-certificate -c "%s" /Library/Keychains/System.keychain',
            $cName
        ));

        $this->cli->runAsUser(sprintf(
            'openssl req -new -newkey rsa:2048 -days 730 -nodes -x509 -subj "/C=/ST=/O=%s/localityName=/commonName=%s/organizationalUnitName=Developers/emailAddress=%s/" -keyout "%s" -out "%s"',
            $oName, $cName, 'rootcertificate@laravel.valet', $caKeyPath, $caPemPath
        ));
        $this->trustCa($caPemPath);
    }
function createCa ( ) { $ caPemPath = $ this -> caPath ( ) . '/LaravelValetCASelfSigned.pem' ; $ caKeyPath = $ this -> caPath ( ) . '/LaravelValetCASelfSigned.key' ; if ( $ this -> files -> exists ( $ caKeyPath ) && $ this -> files -> exists ( $ caPemPath ) ) { return ; } $ oName = 'Laravel Valet CA Self Signed Organization' ; $ cName = 'Laravel Valet CA Self Signed CN' ; if ( $ this -> files -> exists ( $ caKeyPath ) ) { $ this -> files -> unlink ( $ caKeyPath ) ; } if ( $ this -> files -> exists ( $ caPemPath ) ) { $ this -> files -> unlink ( $ caPemPath ) ; } $ this -> cli -> run ( sprintf ( 'sudo security delete-certificate -c "%s" /Library/Keychains/System.keychain' , $ cName ) ) ; $ this -> cli -> runAsUser ( sprintf ( 'openssl req -new -newkey rsa:2048 -days 730 -nodes -x509 -subj "/C=/ST=/O=%s/localityName=/commonName=%s/organizationalUnitName=Developers/emailAddress=%s/" -keyout "%s" -out "%s"' , $ oName , $ cName , 'rootcertificate@laravel.valet' , $ caKeyPath , $ caPemPath ) ) ; $ this -> trustCa ( $ caPemPath ) ; }
If CA and root certificates are nonexistent, crete them and trust the root cert.

@return void
If CA and root certificates are nonexistent crete them and trust the root cert .