コード例 #1
0
 public function renderDestroy()
 {
     $categoryId = $this->getInt('id');
     $articlesInCategory = Article::collection(['category_id' => $categoryId]);
     $videosInCategory = Video::collection(['category_id' => $categoryId]);
     if ($articlesInCategory->hasMappers() || $videosInCategory->hasMappers()) {
         Redirect::to('/' . $this->baseUri())->with('msg', new TransportMessage('error', 'Category cannot be deleted. Some Articles/Videos belong to it'))->now();
     } else {
         $category = new Category($categoryId);
         $category->delete();
         Redirect::to('/' . $this->baseUri())->with('msg', new TransportMessage('success', 'Category was successfully deleted'))->now();
     }
 }
コード例 #2
0
ファイル: VideoBackController.php プロジェクト: qubes/support
 public function renderIndex()
 {
     $Videos = Video::collection()->loadAll();
     return new Index($Videos);
 }