Пример #1
0
 /**
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function index()
 {
     $localCode = strtoupper(App::getLocale());
     /* Load Model */
     $headerModel = new Models\HeaderModel();
     $sldModel = new Models\SliderModel();
     $cateModel = new Models\TourCategoryModel();
     $tourModel = new Models\TourModel();
     $newsModel = new Models\NewsModel();
     /* Init Data */
     $headerData = $headerModel->index($localCode);
     $sliderData = $sldModel->index($localCode);
     $cateData = $cateModel->index($localCode);
     $tourRcm = $tourModel->indexTourRecommended($localCode);
     $latestNews = $newsModel->latestNewsIndex($localCode);
     $indexData = array("headerData" => $headerData, "sliderData" => $sliderData, "cateData" => $cateData, "tourRcm" => $tourRcm, "latestNews" => $latestNews);
     return view('index', $indexData);
 }
Пример #2
0
 public function tourReview(Request $request)
 {
     $tourModel = new Models\TourModel();
     $localCode = strtoupper(App::getLocale());
     $id = $request->input('id');
     $firstName = $request->input('firstName');
     $lastName = $request->input('lastName');
     $email = $request->input('email');
     $title = $request->input('title');
     $content = $request->input('content');
     $rate = $request->input('rate');
     switch ($localCode) {
         case "VI":
             $success = "Cảm ơn những chia sẽ và góp ý của bạn.";
             $fail = "Lỗi hệ thống, vui lòng thử lai sau.";
             break;
         case "EN":
             $success = "Thank for your sharing feedback.";
             $fail = "System error. Please try again later.";
             break;
         default:
             $success = "Thank for your sharing feedback.";
             $fail = "System error. Please try again later.";
             break;
     }
     $insertArr = array("POST_ID" => $id, "FIRST_NAME" => $firstName, "LAST_NAME" => $lastName, "EMAIL" => $email, "COMMENT_TITLE" => $title, "COMMENT_CONTENT" => $content, "COMMENT_RATE" => $rate);
     $result = $tourModel->tourReview($insertArr, $rate, $id);
     if ($result) {
         return response()->json(['info' => 'Success', 'Content' => $success], 200);
     } else {
         return response()->json(['info' => 'Fail', 'Content' => $fail], 200);
     }
 }