private function canUpdate()
    {
        $this->info("Validating");

        // Exists as a directory
        if(!file_exists(pluginsPath($this->pluginNamespace))) {
            throw new \Exception("Plugin ".$this->pluginNamespace." not found in plugins directory!");
        }

        // Plugin should be in DB Table
        if(!Plugin::where('namespace', $this->pluginNamespace)->first()) {
            throw new \Exception("Plugin ".$this->pluginNamespace." doesn't exists in DB!");
        }

        // Clear laravel compiled files
        $this->callSilent('clear-compiled');

        // Remove composer autoloader
        //        exec('composer dump-autoload', $output, $return_var);

        // Plugin class exists
        $fullNamespace =  'Plugins\\'.str_replace('/', '\\', $this->pluginNamespace.'\\Plugin');

        if(!class_exists($fullNamespace)) {
            // When composer autoload was generated, we didn't have this plugin's classes
            // that's why we have to autoload all Plugin' classes manually
            spl_autoload_register(
                function ($class) {
                    $class = str_replace("\\", "/", $class);
                    $class = str_replace("Plugins", "plugins", $class);
                    include base_path().'/' . $class. '.php';
                }
            );
        }

        // Make sure Plugin namespace class exist
        if(!class_exists($fullNamespace)) {
            throw new \Exception("Class $fullNamespace not found!");
        }

        // Plugin needs to have an "update" method
        $this->pluginInstance = new $fullNamespace();
        if(!method_exists($this->pluginInstance, 'update')) {
            throw new \Exception("Plugin ".$this->pluginNamespace." does not have an update method!");
        }

        // Config file exist
        if(!file_exists(pluginsPath($this->pluginNamespace.'/config.json'))) {
            throw new \Exception("Plugin ".$this->pluginNamespace." config.file does not exists!");
        }
        return true;
    }
private function canUpdate()
    {
        $this->info("Validating");

        // Exists as a directory
        if(!file_exists(pluginsPath($this->pluginNamespace))) {
            throw new \Exception("Plugin ".$this->pluginNamespace." not found in plugins directory!");
        }

        // Plugin should be in DB Table
        if(!Plugin::where('namespace', $this->pluginNamespace)->first()) {
            throw new \Exception("Plugin ".$this->pluginNamespace." doesn't exists in DB!");
        }

        // Clear laravel compiled files
        $this->callSilent('clear-compiled');

        // Remove composer autoloader
        //        exec('composer dump-autoload', $output, $return_var);

        // Plugin class exists
        $fullNamespace =  'Plugins\\'.str_replace('/', '\\', $this->pluginNamespace.'\\Plugin');

        if(!class_exists($fullNamespace)) {
            // When composer autoload was generated, we didn't have this plugin's classes
            // that's why we have to autoload all Plugin' classes manually
            spl_autoload_register(
                function ($class) {
                    $class = str_replace("\\", "/", $class);
                    $class = str_replace("Plugins", "plugins", $class);
                    include base_path().'/' . $class. '.php';
                }
            );
        }

        // Make sure Plugin namespace class exist
        if(!class_exists($fullNamespace)) {
            throw new \Exception("Class $fullNamespace not found!");
        }

        // Plugin needs to have an "update" method
        $this->pluginInstance = new $fullNamespace();
        if(!method_exists($this->pluginInstance, 'update')) {
            throw new \Exception("Plugin ".$this->pluginNamespace." does not have an update method!");
        }

        // Config file exist
        if(!file_exists(pluginsPath($this->pluginNamespace.'/config.json'))) {
            throw new \Exception("Plugin ".$this->pluginNamespace." config.file does not exists!");
        }
        return true;
    }
private function canUpdate ( ) { $ this -> info ( "Validating" ) ; // Exists as a directory if ( ! file_exists ( pluginsPath ( $ this -> pluginNamespace ) ) ) { throw new \ Exception ( "Plugin " . $ this -> pluginNamespace . " not found in plugins directory!" ) ; } // Plugin should be in DB Table if ( ! Plugin :: where ( 'namespace' , $ this -> pluginNamespace ) -> first ( ) ) { throw new \ Exception ( "Plugin " . $ this -> pluginNamespace . " doesn't exists in DB!" ) ; } // Clear laravel compiled files $ this -> callSilent ( 'clear-compiled' ) ; // Remove composer autoloader //        exec('composer dump-autoload', $output, $return_var); // Plugin class exists $ fullNamespace = 'Plugins\\' . str_replace ( '/' , '\\' , $ this -> pluginNamespace . '\\Plugin' ) ; if ( ! class_exists ( $ fullNamespace ) ) { // When composer autoload was generated, we didn't have this plugin's classes // that's why we have to autoload all Plugin' classes manually spl_autoload_register ( function ( $ class ) { $ class = str_replace ( "\\" , "/" , $ class ) ; $ class = str_replace ( "Plugins" , "plugins" , $ class ) ; include base_path ( ) . '/' . $ class . '.php' ; } ) ; } // Make sure Plugin namespace class exist if ( ! class_exists ( $ fullNamespace ) ) { throw new \ Exception ( "Class $fullNamespace not found!" ) ; } // Plugin needs to have an "update" method $ this -> pluginInstance = new $ fullNamespace ( ) ; if ( ! method_exists ( $ this -> pluginInstance , 'update' ) ) { throw new \ Exception ( "Plugin " . $ this -> pluginNamespace . " does not have an update method!" ) ; } // Config file exist if ( ! file_exists ( pluginsPath ( $ this -> pluginNamespace . '/config.json' ) ) ) { throw new \ Exception ( "Plugin " . $ this -> pluginNamespace . " config.file does not exists!" ) ; } return true ; }
Checks if a plugin can be updated

@return bool
@throws \Exception
Checks if a plugin can be updated