Devise\Pages\PageManager::destroyPage PHP Method

destroyPage() public method

Destroys a page
public destroyPage ( integer $id ) : boolean
$id integer
return boolean
    public function destroyPage($id)
    {
        $page = $this->Page->findOrFail($id);
        $page->versions()->delete();
        $this->cacheDeviseRoutes();
        return $page->delete();
    }

Usage Example

Beispiel #1
0
 /**
  * Request the page be deleted from database
  *
  * @param  integer $id
  * @return Redirector
  */
 public function requestDestroyPage($id)
 {
     $page = $this->PageManager->destroyPage($id);
     if ($page) {
         return $this->Redirect->route('dvs-pages')->with('warnings', $this->PageManager->warnings)->with('message', $this->PageManager->message);
     }
     return $this->Redirect->route('dvs-pages')->withInput()->withErrors($this->PageManager->errors)->with('message', $this->PageManager->message);
 }