コード例 #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();
 }
コード例 #2
0
 public function renderDestroy()
 {
     $sectionId = $this->getInt('id');
     $articleSection = new ArticleSection($sectionId);
     $articleSection->delete();
     $sectionBlocks = ArticleSectionBlock::collection(['article_section_id' => $sectionId]);
     foreach ($sectionBlocks as $block) {
         $block->delete();
     }
     Redirect::to('/admin/article/' . $articleSection->articleId . '/edit')->now();
     die;
 }