public function getTableLaunchers($name, $get_version = 'all') { $cache_key = 'table-launchers-' . $name . '-' . $get_version; if (Cache::tags('launchers')->has($cache_key)) { $modpacks_array = Cache::tags('launchers')->get($cache_key); } else { $modpacks_array = []; $modpack_id_array = []; $get_version = $this->getVersion($get_version); $launcher = Launcher::where('slug', '=', $name)->first(); $launcher_id = $launcher->id; if ($get_version == 'all') { $raw_modpacks = Modpack::where('launcher_id', '=', $launcher_id)->with('creators')->with('version')->with('launcher')->get(); } else { $version = MinecraftVersion::where('name', '=', $get_version)->first(); $version_id = $version->id; $raw_modpacks = Modpack::where('launcher_id', '=', $launcher_id)->where('minecraft_version_id', '=', $version_id)->with('creators')->with('launcher')->with('version')->get(); } foreach ($raw_modpacks as $modpack) { if (in_array($modpack->id, $modpack_id_array)) { continue; } $modpacks_array[] = $this->buildModpackArray($modpack); $mod_id_array[] = $modpack->id; } Cache::tags('launchers')->forever($cache_key, $modpacks_array); } return $this->buildDTLauncherOutput($modpacks_array); }
public function getLauncherVersion($name, $version = 'all') { $table_javascript = route('tdf_name', ['launchers', $version, $name]); $version = $this->getVersion($version); if ($version == 'all') { $version = 'All'; } $launcher = Launcher::where('slug', '=', $name)->first(); if (!$launcher) { App::abort(404); } $raw_links = ['website' => $launcher->website, 'download_link' => $launcher->download_link, 'donate_link' => $launcher->donate_link, 'wiki_link' => $launcher->wiki_link]; $links = []; foreach ($raw_links as $index => $link) { if ($link != '') { $links["{$index}"] = $link; } } $title = $version . ' ' . $launcher->name . ' Modpacks - ' . $this->site_name; $meta_description = $version . ' Modpacks for ' . $launcher->name; return View::make('launchers.list', ['table_javascript' => $table_javascript, 'version' => $version, 'launcher' => $launcher, 'links' => $links, 'title' => $title, 'meta_description' => $meta_description]); }