Ejemplo n.º 1
0
 public function renderDestroy()
 {
     $articleId = $this->getInt('id');
     $article = new Article($articleId);
     $article->delete();
     $sections = ArticleSection::collection(['article_id' => $articleId]);
     foreach ($sections as $section) {
         $articleSection = new ArticleSection($section->id());
         $articleSection->delete();
         $sectionBlocks = ArticleSectionBlock::collection(['article_section_id' => $section->id()]);
         foreach ($sectionBlocks as $block) {
             $block->delete();
         }
     }
     Redirect::to('/' . $this->baseUri())->with('msg', new TransportMessage('success', 'Article was successfully deleted'))->now();
 }