/** * Catch calls to fields on * the page's related entry. * * @param string $key * @return mixed */ public function __get($key) { $entry = $this->object->getEntry(); if ($entry->hasField($key)) { return (new Decorator())->decorate($entry)->{$key}; } return parent::__get($key); }
/** * Handle the command. * * @param PageRepositoryInterface $pages */ public function handle(EloquentRepositoryInterface $repository) { if ($entry = $this->page->getEntry()) { $repository->delete($entry); } }