/** * 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); } }