/** * Handle the command. * * @param MenuRepositoryInterface $menus * @return MenuInterface|null */ public function handle(MenuRepositoryInterface $menus) { if (is_numeric($this->identifier)) { return $menus->find($this->identifier); } if (is_string($this->identifier)) { return $menus->findBySlug($this->identifier); } if ($this->identifier instanceof Presenter) { return $this->identifier->getObject(); } if (is_object($this->identifier)) { return $this->identifier; } return null; }