public function save($type) { switch ($type) { case 'lienlac': $data = array("address" => Input::get("tenbophan"), "tel" => Input::get("sodienthoai"), "fax" => Input::get("sofax"), "email" => Input::get("email"), "facebook" => Input::get("facebook"), "link" => Input::get("urlfacebook"), "vitri" => Input::get("vitri")); Contact::InsertLL($data); return View::make('admin.lienlac.add')->with("message", "Thêm mới liên lạc thành công!")->with("title", "Thêm mới liên lạc"); case 'baiviet': $filename = ""; if (isset($_FILES['anhnho'])) { // ------Process your file upload code ------- $file = Input::file('anhnho'); // $file->resize(96,96); $destinationPath = 'uploads/'; $filename = md5($file->getClientOriginalName()) . "." . $file->getClientOriginalExtension(); Input::file('anhnho')->move($destinationPath, $filename); } $data = array("tieude" => Input::get('tieude'), "anhnho" => $destinationPath . "/" . $filename, "loai" => Input::get('loaibaiviet'), "noidung" => Input::get('noidung'), "thoidiemdang" => date("Y-m-d H:i:s", time())); TinTuc::InsertTT($data); return View::make('admin.threads.add')->with("title", "Thêm mới bài viết")->with("message", "Đăng tin thành công!"); default: return $this->index(); } }