Devise\Pages\ApiPagesManager::createNewPage PHP Method

createNewPage() public method

Validates and creates a page with the given input
public createNewPage ( $input ) : boolean
return boolean
    public function createNewPage($input)
    {
        $input['response_type'] = 'Function';
        $page = $this->createPageFromInput($input);
        if ($page) {
            $startsAt = new \DateTime();
            // is published immediately
            $page->version = $this->PageVersionManager->createDefaultPageVersion($page, $startsAt);
            $this->RoutesGenerator->cacheRoutes();
        }
        return $page;
    }

Usage Example

 /**
  * Request a new page be created
  *
  * @param  array $input
  * @return Redirector
  */
 public function requestCreateNewPage($input)
 {
     if (isset($input['response_class']) && isset($input['response_method'])) {
         $input['response_path'] = $input['response_class'] . '.' . $input['response_method'];
     }
     $page = $this->ApiPagesManager->createNewPage($input);
     if ($page) {
         return $this->Redirect->route('dvs-api');
     }
     return $this->Redirect->route('dvs-api-create')->withInput()->withErrors($this->ApiPagesManager->errors)->with('message', $this->ApiPagesManager->message);
 }
ApiPagesManager