protected function checkDependency($dependencies = null)
    {
        $errors = array();

        if (is_null($dependencies)) $dependencies = array();

        $i = 0;
        $clean = true;
        foreach ($dependencies as $module => $version)
        {
            if ($module == $this->systemName)
            {
                if (!$this->sysVersionDependency($version))
                    $clean = false;

                continue;
            }

            $depModule = ModuleModel::where('module_name', $module)->first();
            if (!$depModule)
            {
                $this->errors->add("module_dependency_$i", "Module $module with version $version not installed");
                $clean = false;
            }
            else
            {
                $depVersion = $depModule->module_version;
                $needVersion = $version;

                $depVersion = new Version($depVersion);
                $needVersion = new Version($needVersion);

                if (!$depVersion->isPartOf($needVersion))
                {
                    $this->errors->add("module_dependency_$i", 'Module '.$module.' v'.$needVersion->getVersion().' must install, but '.$depVersion->getVersion().' installed.');
                    $clean = false;
                }
            }
            $i++;
        }

        if(!$clean)
            return false;

        return true;
    }
protected function checkDependency($dependencies = null)
    {
        $errors = array();

        if (is_null($dependencies)) $dependencies = array();

        $i = 0;
        $clean = true;
        foreach ($dependencies as $module => $version)
        {
            if ($module == $this->systemName)
            {
                if (!$this->sysVersionDependency($version))
                    $clean = false;

                continue;
            }

            $depModule = ModuleModel::where('module_name', $module)->first();
            if (!$depModule)
            {
                $this->errors->add("module_dependency_$i", "Module $module with version $version not installed");
                $clean = false;
            }
            else
            {
                $depVersion = $depModule->module_version;
                $needVersion = $version;

                $depVersion = new Version($depVersion);
                $needVersion = new Version($needVersion);

                if (!$depVersion->isPartOf($needVersion))
                {
                    $this->errors->add("module_dependency_$i", 'Module '.$module.' v'.$needVersion->getVersion().' must install, but '.$depVersion->getVersion().' installed.');
                    $clean = false;
                }
            }
            $i++;
        }

        if(!$clean)
            return false;

        return true;
    }
protected function checkDependency ( $ dependencies = null ) { $ errors = array ( ) ; if ( is_null ( $ dependencies ) ) $ dependencies = array ( ) ; $ i = 0 ; $ clean = true ; foreach ( $ dependencies as $ module => $ version ) { if ( $ module == $ this -> systemName ) { if ( ! $ this -> sysVersionDependency ( $ version ) ) $ clean = false ; continue ; } $ depModule = ModuleModel :: where ( 'module_name' , $ module ) -> first ( ) ; if ( ! $ depModule ) { $ this -> errors -> add ( "module_dependency_$i" , "Module $module with version $version not installed" ) ; $ clean = false ; } else { $ depVersion = $ depModule -> module_version ; $ needVersion = $ version ; $ depVersion = new Version ( $ depVersion ) ; $ needVersion = new Version ( $ needVersion ) ; if ( ! $ depVersion -> isPartOf ( $ needVersion ) ) { $ this -> errors -> add ( "module_dependency_$i" , 'Module ' . $ module . ' v' . $ needVersion -> getVersion ( ) . ' must install, but ' . $ depVersion -> getVersion ( ) . ' installed.' ) ; $ clean = false ; } } $ i ++ ; } if ( ! $ clean ) return false ; return true ; }
Check module dependencies

@param array $dependencies
@return bool
Check module dependencies