public function postDelete()
 {
     if (Session::get('logininfo')->level != 1) {
         return view('admin.error');
     }
     $product = product::where('user', Input::get('id'))->get();
     if (count($product) > 0) {
         if (Input::exists('json')) {
             return json_encode(array('result' => -1, 'message' => 'QTV "' . Input::get('title') . '" đã đăng sản phẩm. Không thể xóa'));
         }
         return redirect('admin/ad')->with(['message' => 'QTV "' . Input::get('title') . '" đã đăng sản phẩm. Không thể xóa']);
     }
     $news = news::where('user', Input::get('id'))->get();
     if (count($news) > 0) {
         if (Input::exists('json')) {
             return json_encode(array('result' => -1, 'message' => 'QTV "' . Input::get('title') . '" đã đăng tin tức. Không thể xóa'));
         }
         return redirect('admin/ad')->with(['message' => 'QTV "' . Input::get('title') . '" đã đăng tin tức. Không thể xóa']);
     }
     $admin = admin::find(Input::get('id'));
     if ($admin->delete()) {
         if (Input::exists('json')) {
             return json_encode(array('result' => 1));
         }
         return redirect('admin/ad')->with(['message' => 'Xóa thành công QTV "' . Input::get('title') . '"']);
     } else {
         if (Input::exists('json')) {
             return json_encode(array('result' => -1, 'message' => 'Có lỗi. Xóa thất bại'));
         }
         return redirect('admin/ad')->with(['message' => 'QTV "' . Input::get('title') . '" đã có sản phẩm. Không thể xóa']);
     }
 }
 public function postDeleteCategory()
 {
     $news = news::where('categoryNewsID', Input::get('id'))->get();
     if (count($news) > 0) {
         if (Input::exists('json')) {
             return json_encode(array('result' => -1, 'message' => 'Loại tin tức "' . Input::get('title') . '" đã có tin tức. Không thể xóa'));
         }
         return redirect('admin/news/category')->with(['message' => 'Loại tin tức "' . Input::get('title') . '" đã có tin tức. Không thể xóa']);
     }
     $category = categorynews::find(Input::get('id'));
     if ($category->delete()) {
         if (Input::exists('json')) {
             return json_encode(array('result' => 1));
         }
         return redirect('admin/news/category')->with(['message' => 'Xóa thành công loại tin tức "' . Input::get('title') . '"']);
     } else {
         if (Input::exists('json')) {
             return json_encode(array('result' => -1, 'message' => 'Có lỗi. Xóa thất bại'));
         }
         return redirect('admin/news/category')->with(['message' => 'Xóa thất bại. Vui lòng thử lại']);
     }
 }
 public static function getNewsNew()
 {
     return news::orderBy('id', 'desc')->take(5)->get();
 }