Create form for a new resource.

@param \TypiCMS\Modules\Pages\Models\Page $page

@return \Illuminate\View\View
974985
public function create(Page $page)
    {
        $model = $this->repository->createModel();

        return view('pages::admin.create-section')
            ->with(compact('model', 'page'));
    }
1107405
public function view($page, $id)
    {
        $this->authorize('view', $eloquent = app('scaffold.model'));

        app('scaffold.widget')->add(
            (new EloquentWidget($eloquent))
                ->setOrder(0)
                ->setTab(AbstractWidget::TAB_DEFAULT)
                ->setPlacement('model')
        );

        return view(app('scaffold.template')->view('index'), [
            'item' => $eloquent,
        ]);
    }
48735
public function add(Request $request, Page $page)
    {
        $this->auth($page);

        $name = $request->input('tag');
        $group = $request->input('group');

        $tag = TagFacade::findOrCreate($name, $group);

        $page->addTag($tag);

        Event::fire(new PageHadTagAdded($page, $tag));

        return $tag->getId();
    }
508352
public function addPage($page = null)
    {
        if ($page = parent::addPage($page)) {
            $page->setParent($this);
        }

        return $page;
    }
1332049
public function showAction(Page $page)
    {
        $deleteForm = $this->createDeleteForm($page);

        return array(
            'page' => $page,
            'delete_form' => $deleteForm->createView(),
        );
    }
1331393
public function setPage(\Haven\CmsBundle\Entity\Page $page = null) {
        $this->page = $page;

        return $this;
    }
383747
public function edit($page, $id)
    {
        $this->authorize('update', $eloquent = app('scaffold.model'));

        return view(app('scaffold.template')->edit('index'), [
            'item' => $eloquent,
        ]);
    }
980565
public function index(Page $page)
    {
        save_resource_url();

        $page->load('sections');

        return $this->view('titan::pages.components.page_components')->with('page', $page);
    }
101049
private function renderPage(Page $page, Request $request)
    {
        return $this->get('synapse')
            ->createDecorator($page)
            ->decorate(array(
                'page' => $page,
                'request' => $request,
            ))
        ;
    }
233824
public function showAction(ErrorPage $page)
    {
        //add the view to twig
        $this->container->get('twig')->addGlobal('view', $page);
        $page->setReference(new ViewReference($page->getId()));
        $parameters = [
            'view'   => $page,
            'id'     => $page->getId(),
            'locale' => $page->getCurrentLocale(),
        ];

        $this->get('victoire_widget_map.builder')->build($page);
        $this->get('victoire_widget_map.widget_data_warmer')->warm(
            $this->get('doctrine.orm.entity_manager'),
            $page
        );

        $this->container->get('victoire_core.current_view')->setCurrentView($page);

        //create the response
        $response = $this->container->get('templating')->renderResponse(
            'VictoireCoreBundle:Layout:'.$page->getTemplate()->getLayout().'.html.twig',
            $parameters
        );

        return $response;
    }
1293878
public function store(Page $page, PageSectionFormRequest $request)
    {
        $section = $this->repository->create($request->all());
        Pages::forgetCache();

        return $this->redirect($request, $section);
    }
989641
public function created(Page $model)
    {
        if ($menu_id = request('add_to_menu')) {
            $position = $this->getPositionFormMenu($menu_id);
            $data = [
                'menu_id' => $menu_id,
                'page_id' => $model->id,
                'position' => $position,
            ];
            foreach (locales() as $locale) {
                $data['title'][$locale] = $model->translate('title', $locale);
                $data['status'][$locale] = 0;
                $data['url'][$locale] = '';
            }
            Menulink::create($data);
        }
    }
542782
public function postTemplate(Page $page, Template $template)
    {
        $this->authorize('editTemplate', $page);

        $page->setTemplate($template);

        Event::fire(new Events\PageTemplateWasChanged($page, $template));

        return $page->getCurrentVersion()->getStatus();
    }
160743
public function edit(Page $page)
    {
        // fix for when you
        // edit sections from the edit page
        // or delete photo/document then
        // need to update resource url
        save_resource_url();

        $parents = Page::getAllList();
        $banners = Banner::getAllList();

        return $this->view('titan::pages.create_edit', compact('parents', 'banners'))->with('item', $page);
    }
559024
public function allowPage($page)
    {
        if (is_array($page)) {
            foreach ($page as $p) {
                $this->allowPage($p);
            }

            return $this;
        }
        $this->allowed_pages[] = $page;

        return $this;
    }
1143363
public function setPage(Page $page)
    {
        $this->page = $page;
        $revision = $page->getCurrentRevision();
        if (empty($revision)) {
            $revision = $page->getPublishedRevision();
        }
        $revisionId = null;
        if (!empty($revision)) {
            $revisionId = $revision->getRevisionId();
        }
        $this->setRevisionId($revisionId);
        $this->setTitle($page->getPageTitle());
        $this->setPageId($page->getPageId());
    }
132172
public function postAdd(Page $page)
    {
        $this->authorize('add', $page);

        $parent = $page->getAddPageParent();
        $newPage = $this->dispatch(new CreatePage($parent));

        return PageFacade::find($newPage->getId());
    }