public function destroy($id)
 {
     VideoCategory::destroy($id);
     $child_cats = VideoCategory::where('parent_id', '=', $id)->get();
     foreach ($child_cats as $cats) {
         $cats->parent_id = NULL;
         $cats->save();
     }
     return Redirect::to('admin/videos/categories')->with(array('note' => 'Successfully Deleted Category', 'note_type' => 'success'));
 }
 public function category($category)
 {
     $page = Input::get('page');
     if (!empty($page)) {
         $page = Input::get('page');
     } else {
         $page = 1;
     }
     $cat = VideoCategory::where('slug', '=', $category)->first();
     $parent_cat = VideoCategory::where('parent_id', '=', $cat->id)->first();
     if (!empty($parent_cat->id)) {
         $parent_cat2 = VideoCategory::where('parent_id', '=', $parent_cat->id)->first();
         if (!empty($parent_cat2->id)) {
             $videos = Video::where('active', '=', '1')->where('video_category_id', '=', $cat->id)->orWhere('video_category_id', '=', $parent_cat->id)->orWhere('video_category_id', '=', $parent_cat2->id)->orderBy('created_at', 'DESC')->simplePaginate(9);
         } else {
             $videos = Video::where('active', '=', '1')->where('video_category_id', '=', $cat->id)->orWhere('video_category_id', '=', $parent_cat->id)->orderBy('created_at', 'DESC')->simplePaginate(9);
         }
     } else {
         $videos = Video::where('active', '=', '1')->where('video_category_id', '=', $cat->id)->orderBy('created_at', 'DESC')->simplePaginate(9);
     }
     $data = array('videos' => $videos, 'current_page' => $page, 'category' => $cat, 'page_title' => 'Videos - ' . $cat->name, 'page_description' => 'Page ' . $page, 'pagination_url' => '/videos/category/' . $category, 'menu' => Menu::orderBy('order', 'ASC')->get(), 'video_categories' => VideoCategory::all(), 'post_categories' => PostCategory::all(), 'theme_settings' => ThemeHelper::getThemeSettings(), 'pages' => Page::all());
     return View::make('Theme::video-list', $data);
 }