/** * Setzt den Cache für die URI-Aliase * * @return boolean */ public function saveCache() { $aliases = $this->seoRepository->getAllMetaTags(); $cAliases = count($aliases); $data = []; for ($i = 0; $i < $cAliases; ++$i) { $data[$aliases[$i]['uri']] = ['alias' => $aliases[$i]['alias'], 'keywords' => $aliases[$i]['keywords'], 'description' => $aliases[$i]['description'], 'robots' => $aliases[$i]['robots']]; } return $this->cache->save('seo', $data); }
/** * Inserts/Updates a given URL alias * * @param string $path * @param string $alias * @param string $keywords * @param string $description * @param int $robots * * @return boolean */ public function insertUriAlias($path, $alias, $keywords = '', $description = '', $robots = 0) { $path .= $this->preparePath($path); $data = ['alias' => $alias, 'seo_keywords' => $keywords, 'seo_description' => $description, 'seo_robots' => (int) $robots]; $seo = $this->seoRepository->getOneByUri($path); if (!empty($seo)) { $data['uri'] = $seo['uri']; $bool = $this->seoModel->save($data, $seo['id']); } else { $data['uri'] = $path; $bool = $this->seoModel->save($data); } return $bool !== false; }