initHome(); } public function initHome() { $user = Dashboard::getUser(); $dashboardItem = $this->getItem('dashboard'); $homes = Home::on(Dashboard::getConn()); $homes->filter(Filter::equal('username', $user->getUsername())); foreach ($homes as $home) { $dashboardHome = new DashboardHomeItem($home->name, [ 'uuid' => $home->id, 'label' => t($home->label), 'priority' => $home->priority, 'type' => $home->type, ]); $dashboardItem->addChild($dashboardHome); } } /** * Load dashboard homes form the navigation menu * * @return DashboardHome[] */ public function loadHomes() { $homes = []; foreach ($this->getItem('dashboard')->getChildren() as $child) { if (! $child instanceof DashboardHomeItem) { continue; } $homes[$child->getName()] = DashboardHome::create($child); } return $homes; } }