/** * Handle the command. */ public function handle(LinkRepositoryInterface $links) { /* @var LinkInterface $link */ foreach ($this->link->getChildren() as $link) { $links->save($link->setParentId(null)); } }
/** * Run the seeder. */ public function run() { $repository = new EntryRepository(); $repository->setModel(new UrlLinkTypeModel()); $repository->truncate(); $menu = $this->menus->findBySlug('footer'); $pyrocms = $repository->create(['en' => ['title' => 'PyroCMS.com'], 'url' => 'http://pyrocms.com/']); $documentation = $repository->create(['en' => ['title' => 'Documentation'], 'url' => 'http://pyrocms.com/documentation']); $this->links->truncate(); $this->links->create(['menu' => $menu, 'target' => '_blank', 'entry' => $pyrocms, 'type' => 'anomaly.extension.url_link_type']); $this->links->create(['menu' => $menu, 'target' => '_blank', 'entry' => $documentation, 'type' => 'anomaly.extension.url_link_type']); }
/** * Delete a link and go back. * * @param LinkRepositoryInterface $links * @param Authorizer $authorizer * @param $id * @return \Illuminate\Http\RedirectResponse */ public function delete(LinkRepositoryInterface $links, Authorizer $authorizer, $id) { if (!$authorizer->authorize('anomaly.module.navigation::links.delete')) { $this->messages->error('streams::message.access_denied'); return $this->redirect->back(); } /** * Force delete until we get * views into the tree UI. */ $links->forceDelete($links->find($id)); return $this->redirect->back(); }
/** * Delete a link and go back. * * @param LinkRepositoryInterface $links * @param Authorizer $authorizer * @param $id * @return \Illuminate\Http\RedirectResponse */ public function delete(LinkRepositoryInterface $links, Authorizer $authorizer, $id) { if (!$authorizer->authorize('anomaly.module.navigation::links.delete')) { $this->messages->error('streams::message.access_denied'); return $this->redirect->back(); } $links->delete($links->find($id)); return $this->redirect->back(); }
/** * Handle the command. * * @param LinkRepositoryInterface $links */ public function handle(LinkRepositoryInterface $links) { foreach ($this->menu->getLinks() as $link) { $links->delete($link); } }