/** * Handle the command. */ public function handle() { /* @var LinkInterface|EloquentModel $link */ foreach ($this->links as $link) { $link->setRelation('children', $this->links->children($link)); } }
/** * Handle the command. * * @param Guard $auth */ public function handle(Guard $auth) { /* @var UserInterface|null $user */ $user = $auth->user(); /* @var LinkInterface $link */ foreach ($this->links as $key => $link) { $roles = $link->getAllowedRoles(); /** * If there are role restrictions * but no user is signed in then * we can't authorize anything! */ if (!$roles->isEmpty() && !$user) { $this->links->forget($key); continue; } /** * If there are role restrictions * and the user does not belong to * any of them then don't show it. */ if (!$roles->isEmpty() && !$user->hasAnyRole($roles)) { $this->links->forget($key); continue; } } }
/** * Handle the command. */ public function handle() { if (!($current = $this->links->current())) { return; } if (!$current->getParentId()) { return; } /* @var LinkInterface $link */ foreach ($this->links as $link) { /** * Already flagged. */ if ($link->isActive() || $link->isCurrent()) { continue; } /** * Set active if the direct * parent of current link. */ if ($link->getId() == $current->getParentId()) { $link->setActive(true); } /** * If the active link is in the children * of this link then mark it active too. */ if (!$this->links->children($link)->active()->isEmpty()) { $link->setActive(true); $this->dispatch(new SetActiveLinks($this->links)); } } }
/** * Handle the command. */ public function handle() { /* @var LinkInterface|EloquentModel $link */ foreach ($this->links as $link) { /* @var LinkInterface $parent */ if (($id = $link->getParentId()) && ($parent = $this->links->find($id))) { $link->setRelation('parent', $parent); } } }
/** * Handle the command. */ public function handle() { $current = $this->links->current(); if (!$current) { return; } //$current->setActive(true); /* @var LinkInterface $link */ foreach ($this->links as $link) { if ($current->getParentId() == $link->getId()) { //$link->setActive(true); } } }