public function add() { $this->authorize('add', $this->page); if (!$this->request->input('noprompt') && $this->page->shouldPromptOnAddPage()) { return ['prompt' => view("{$this->viewPrefix}add", ['page' => $this->page])->render()]; } else { $parent = $this->page->getAddPageParent(); $newPage = $this->dispatch(new CreatePage(auth()->user(), $parent)); Event::fire(new PageWasCreated($newPage, $this->page)); return ['url' => (string) $newPage->url(), 'id' => $newPage->getId()]; } }