public function optimize()
    {
        $cachePath = $this->getCachePath();

        $cache     = $this->getCache();
        $basenames = $this->getAllBasenames();
        $modules   = collect();

        $basenames->each(function ($module, $key) use ($modules, $cache) {
            $basename = collect(['basename' => $module]);
            $temp     = $basename->merge(collect($cache->get($module)));
            $manifest = $temp->merge(collect($this->getManifest($module)));

            $modules->put($module, $manifest);
        });

        $modules->each(function ($module) {
            $module->put('id', crc32($module->get('slug')));

            if (!$module->has('enabled')) {
                $module->put('enabled', config("modules.locations.$this->location.enabled", true));
            }

            if (!$module->has('order')) {
                $module->put('order', 9001);
            }

            return $module;
        });

        $content = json_encode($modules->all(), JSON_PRETTY_PRINT);

        return $this->files->put($cachePath, $content);
    }
public function optimize()
    {
        $cachePath = $this->getCachePath();

        $cache     = $this->getCache();
        $basenames = $this->getAllBasenames();
        $modules   = collect();

        $basenames->each(function ($module, $key) use ($modules, $cache) {
            $basename = collect(['basename' => $module]);
            $temp     = $basename->merge(collect($cache->get($module)));
            $manifest = $temp->merge(collect($this->getManifest($module)));

            $modules->put($module, $manifest);
        });

        $modules->each(function ($module) {
            $module->put('id', crc32($module->get('slug')));

            if (!$module->has('enabled')) {
                $module->put('enabled', config("modules.locations.$this->location.enabled", true));
            }

            if (!$module->has('order')) {
                $module->put('order', 9001);
            }

            return $module;
        });

        $content = json_encode($modules->all(), JSON_PRETTY_PRINT);

        return $this->files->put($cachePath, $content);
    }
public function optimize ( ) { $ cachePath = $ this -> getCachePath ( ) ; $ cache = $ this -> getCache ( ) ; $ basenames = $ this -> getAllBasenames ( ) ; $ modules = collect ( ) ; $ basenames -> each ( function ( $ module , $ key ) use ( $ modules , $ cache ) { $ basename = collect ( [ 'basename' => $ module ] ) ; $ temp = $ basename -> merge ( collect ( $ cache -> get ( $ module ) ) ) ; $ manifest = $ temp -> merge ( collect ( $ this -> getManifest ( $ module ) ) ) ; $ modules -> put ( $ module , $ manifest ) ; } ) ; $ modules -> each ( function ( $ module ) { $ module -> put ( 'id' , crc32 ( $ module -> get ( 'slug' ) ) ) ; if ( ! $ module -> has ( 'enabled' ) ) { $ module -> put ( 'enabled' , config ( "modules.locations.$this->location.enabled" , true ) ) ; } if ( ! $ module -> has ( 'order' ) ) { $ module -> put ( 'order' , 9001 ) ; } return $ module ; } ) ; $ content = json_encode ( $ modules -> all ( ) , JSON_PRETTY_PRINT ) ; return $ this -> files -> put ( $ cachePath , $ content ) ; }
Update cached repository of module information.

@return bool
Update cached repository of module information .