/** * Resolve the page. * * @return Contract\PageInterface|null */ public function resolve() { $action = $this->route->getAction(); if ($id = array_get($action, 'anomaly.module.pages::page')) { return $this->pages->find($id); } if ($path = array_get($action, 'anomaly.module.pages::path')) { return $this->pages->findByPath($path); } return null; }
/** * Handle the command. * * @param PageRepositoryInterface $pages * @param ViewTemplate $template * @return PageInterface|EloquentModel|null */ public function handle(PageRepositoryInterface $pages, ViewTemplate $template) { if (is_null($this->identifier)) { $this->identifier = $template->get('page'); } if (is_numeric($this->identifier)) { return $pages->find($this->identifier); } if (is_string($this->identifier)) { return $pages->findByPath($this->identifier); } if ($this->identifier instanceof PageInterface) { return $this->identifier; } if ($this->identifier instanceof PagePresenter) { return $this->identifier->getObject(); } return null; }