private static function append_pages() { // We only want pages linked by a menu somewhere $menus = Menu::all(); foreach ($menus as $menu) { // Determine importance based on menu hierarchy $level = 0; $tmp = $menu; while ($tmp->parent !== null) { $level += 0.1; $tmp = $tmp->parent; } // Get the page $page = Page::where('permalink', $menu->url)->where('location_id', $menu->location_id)->first(); if ($page != null) { array_push(static::$allPages, ['loc' => URL::to($menu->url), 'mod' => $page->updated_at->toDateString(), 'freq' => 'monthly', 'pri' => 0.7 + $level]); } else { // This was a static link } } }